growfs(8) to lower offset

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

growfs(8) to lower offset

David Higgs
I read both the FAQ section and the growfs(8) man page but I am not
yet confident that what I want to do is supported / safe.

http://www.openbsd.org/faq/faq14.html#GrowPartition

I started with a number of partitions and a bunch of free space.  I
later needed the free space and allocated a /project partition that
went to the end of my disk.  More recently, I emptied the /data
partition immediately prior.  Now I would like to use growfs(8) to
merge this unused space with the /project partition without losing any
of the existing data.

See disklabel output below.  I have only grown partitions "down",
never in the other direction.  Am I being overly paranoid?

Thanks.

--david

[david@apu2 ~]$ doas disklabel sd0
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: SATA SSD
duid: dab5be6fe5a0d623
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 7297
total sectors: 117231408
boundstart: 64
boundend: 117226305
drivedata: 0

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  a:          2104448               64  4.2BSD   2048 16384 12958 # /
  b:          8385933          2104512    swap                    # none
  c:        117231408                0  unused
  d:          8401952         10490464  4.2BSD   2048 16384 12958 # /tmp
  e:          8385952         18892416  4.2BSD   2048 16384 12958 # /var
  f:          4192960         27278368  4.2BSD   2048 16384 12958 # /usr
  g:          2088448         31471328  4.2BSD   2048 16384 12958 # /usr/X11R6
  h:          6281424         33559776  4.2BSD   2048 16384 38128 # /usr/local
  i:          6297440         39841216  4.2BSD   2048 16384 12958 # /usr/ports
  j:          2088448         46138656  4.2BSD   2048 16384 12958 # /home
  k:         16771872         48227104  4.2BSD   2048 16384 12958 # /data
  l:         52227328         64998976  4.2BSD   2048 16384 12958 # /project

Reply | Threaded
Open this post in threaded view
|

Re: growfs(8) to lower offset

Bruno Flueckiger
On 05.11.18 19:47, David Higgs wrote:

> I read both the FAQ section and the growfs(8) man page but I am not
> yet confident that what I want to do is supported / safe.
>
> http://www.openbsd.org/faq/faq14.html#GrowPartition
>
> I started with a number of partitions and a bunch of free space.  I
> later needed the free space and allocated a /project partition that
> went to the end of my disk.  More recently, I emptied the /data
> partition immediately prior.  Now I would like to use growfs(8) to
> merge this unused space with the /project partition without losing any
> of the existing data.
>
> See disklabel output below.  I have only grown partitions "down",
> never in the other direction.  Am I being overly paranoid?
>
> Thanks.
>
> --david
>

As the FAQ entry states, you can use growfs(8) if the empty space
is after the existing partition, not prior. You can only grow a
partition "down", never "up". What you want to do would require the
following steps:

1. Create a new partition on the free space
2. Move all data to the new partition
3. Remove the existing /project partition
4. Use growfs(8) on the new partition to include the space from the old
   /project partition

Cheers,
Bruno

Reply | Threaded
Open this post in threaded view
|

Re: growfs(8) to lower offset

David Higgs
On Tue, Nov 6, 2018 at 8:58 AM Bruno Flueckiger <[hidden email]> wrote:

>
> On 05.11.18 19:47, David Higgs wrote:
> > I read both the FAQ section and the growfs(8) man page but I am not
> > yet confident that what I want to do is supported / safe.
> >
> > http://www.openbsd.org/faq/faq14.html#GrowPartition
> >
> > I started with a number of partitions and a bunch of free space.  I
> > later needed the free space and allocated a /project partition that
> > went to the end of my disk.  More recently, I emptied the /data
> > partition immediately prior.  Now I would like to use growfs(8) to
> > merge this unused space with the /project partition without losing any
> > of the existing data.
> >
> > See disklabel output below.  I have only grown partitions "down",
> > never in the other direction.  Am I being overly paranoid?
> >
> > Thanks.
> >
> > --david
> >
>
> As the FAQ entry states, you can use growfs(8) if the empty space
> is after the existing partition, not prior. You can only grow a
> partition "down", never "up". What you want to do would require the
> following steps:
>
> 1. Create a new partition on the free space
> 2. Move all data to the new partition
> 3. Remove the existing /project partition
> 4. Use growfs(8) on the new partition to include the space from the old
>    /project partition

You appear to be right - I see it now.  I had not read closely enough,
and had focused more on what I could change with the 'm' disklabel(8)
command.  It would be nice if this info were made explicit in the
growfs(8) man page as well.

I had already successfully rearranged some partitions using the method
you propose, but unfortunately the amount of data in /project is
slightly too big to be easily shifted into my remaining free space.
I'll try to compress it or temporarily move the data off-system.

Thanks for the clue-stick.

--david

Reply | Threaded
Open this post in threaded view
|

Re: growfs(8) to lower offset

Chris Bennett-4
On Tue, Nov 06, 2018 at 09:18:27AM -0500, David Higgs wrote:

> > As the FAQ entry states, you can use growfs(8) if the empty space
> > is after the existing partition, not prior. You can only grow a
> > partition "down", never "up". What you want to do would require the
> > following steps:
> >
> > 1. Create a new partition on the free space
> > 2. Move all data to the new partition
> > 3. Remove the existing /project partition
> > 4. Use growfs(8) on the new partition to include the space from the old
> >    /project partition
>
> You appear to be right - I see it now.  I had not read closely enough,
> and had focused more on what I could change with the 'm' disklabel(8)
> command.  It would be nice if this info were made explicit in the
> growfs(8) man page as well.
>
> I had already successfully rearranged some partitions using the method
> you propose, but unfortunately the amount of data in /project is
> slightly too big to be easily shifted into my remaining free space.
> I'll try to compress it or temporarily move the data off-system.
>

I use growfs a lot. I try to plan ahead of time to put partitions that I
can sacrifice when I desperately need to possibly grow something like
/usr/local or some other important partition. Sometimes I have a
partition for the PKG_CACHE when I need to avoid downloading the
packages twice for another computer. This is a partition, for me, that I
can sacrifice and use to grow the preceding partition.
Buy a bigger disk is not always a practical answer.

If you haven't already done it, taking a picture of disklabel, fstab and
df never hurt. Easier than writing it down.

Well, I've been in your position pulling out hairs many times. Worst
case is having a small useless partition stuck in the middle somewhere.

Good Luck,
Chris Bennett