Merging partitions with disklabel/growfs - BSD

This is a discussion on Merging partitions with disklabel/growfs - BSD ; Okay, I guess disklabel and growfs don't work quite the way I thought. Summary: I've got a second hard drive (sd1) partitioned a-k, with sd1h in use. I'd like to merge sd1{d,e,f,g} and sd1{h,i,j,k} to single partitions. I think I've ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Merging partitions with disklabel/growfs

  1. Merging partitions with disklabel/growfs

    Okay, I guess disklabel and growfs don't work quite the way I thought.

    Summary: I've got a second hard drive (sd1) partitioned a-k, with sd1h
    in use. I'd like to merge sd1{d,e,f,g} and sd1{h,i,j,k} to single
    partitions. I think I've at least merged sd1{i,j,k} to sd1i using
    disklabel -e, but growfs sez "unknown device" even though mount, fsck
    and newfs (-N) have no problems.

    System is OpenBSD 3.4 GENERIC#18 i386.

    Starting situation was:

    : disklabel: warning, DOS partition table with no valid OpenBSD partition
    : # /dev/rsd1c:
    [snipped]
    : 16 partitions:
    : # size offset fstype [fsize bsize cpg]
    : a: 1024041 63 4.2BSD 2048 16384 512 # (Cyl. 0*- 885*)
    : b: 1024104 1024104 4.2BSD 2048 16384 512 # (Cyl. 885*- 1771*)
    : c: 35916548 0 unused 0 0 # (Cyl. 0 - 31069*)
    : d: 2097490 2048208 4.2BSD 2048 16384 512 # (Cyl. 1771*- 3586*)
    : e: 4193778 4145698 4.2BSD 2048 16384 512 # (Cyl. 3586*- 7214*)
    : f: 1024104 8339476 4.2BSD 2048 16384 512 # (Cyl. 7214*- 8099*)
    : g: 8388758 9363580 4.2BSD 2048 16384 512 # (Cyl. 8099*- 15356*)
    : h: 8388758 17752338 4.2BSD 2048 16384 512 # (Cyl. 15356*- 22613*)
    : i: 1024104 26141096 4.2BSD 2048 16384 512 # (Cyl. 22613*- 23499*)
    : j: 6291268 27165200 4.2BSD 2048 16384 512 # (Cyl. 23499*- 28941*)
    : k: 2460080 33456468 4.2BSD 2048 16384 512 # (Cyl. 28941*- 31069*)

    FFS on all mounts. The, uh, excessive partitioning is a consequence
    of the drive being a survivor of a previous system, used in the
    migration.

    Rather than mess about with a live partition, I figured the sane thing
    to do was to start by extending sd1i to the end of the drive, check
    that the filesystem survived growfs okay, and then repeat until I'm
    down to sd1d and sd1e.

    Things didn't quite work that way, so if anyone can help knock the
    appropriate clues into me I'd be grateful.

    Fallback plan is to dump the live partition to tape, disklabel -E the
    drive into the paritions I want, and then restore. But the way I see
    it is that I've got a chance to learn how to merge partitions
    *properly*, so why waste it?


    First question: are there any obvious flaws in this strategy?


    Second question: how *exactly* should disklabel be used to reallocate
    sd1i? I'd dive in with -E but the manpage warns:

    : The initial label editor mode is only intended for new disks as
    : it will move partitions around as necessary to maintain a
    : contiguous pool of free blocks.

    which I'm taking to mean (wrongly?) that interesting things may happen
    to following partitions. So: using

    $ sudo disklabel -e sd1

    I got to write

    : i: 9775452 26141096 4.2BSD 2048 16384 512 # (Cyl. 22613*- 31069*)

    okay (AFAICT), but growfs and newfs appear to disagree on whether it's
    committed:

    $ sudo growfs -N /dev/sd1i
    growfs: unknown device
    $ sudo growfs -N /dev/rsd1i
    growfs: unknown device
    $ sudo fsck -f /dev/sd1i
    ** /dev/rsd1i
    ** File system is already clean
    ** Last Mounted on /mnt/i
    ** Phase 1 - Check Blocks and Sizes
    ** Phase 2 - Check Pathnames
    ** Phase 3 - Check Connectivity
    ** Phase 4 - Check Reference Counts
    ** Phase 5 - Check Cyl groups
    12 files, 251299 used, 14 free (14 frags, 0 blocks, 0.0% fragmentation)
    $ sudo disklabel sd1
    ...
    h: 8388758 17752338 4.2BSD 2048 16384 512 # (Cyl. 15356*- 22613*)
    i: 9775452 26141096 4.2BSD 2048 16384 512 # (Cyl. 22613*- 31069*)
    ^^^^^^^
    $ sudo newfs -N /dev/rsd1i
    Warning: cylinder groups must have a multiple of 16 cylinders
    Warning: 262 sector(s) in last cylinder unallocated
    /dev/rsd1i: 9775452 sectors in 16913 cylinders of 1 tracks, 578 sectors
    ^^^^^^^

    Yes, it mounts happily, too.

    Have I maybe missed an obvious step involving disklabel -rw? I
    haven't been able to find a working combination of options without
    providing a disktab label, but can't match the drive against anything
    in /etc/disktab. Huh.


    Third question: assuming the label's set up right (a big assumption, I
    know), just why is growfs unhappy? The device and the filesystem are
    evidently okay, yet growfs still complains "unknown device".


    I'm stumped. Any suggestions? Or pointers towards the parts of the
    manpages that apparently went over my head?

    If it's at all useful, the [snipped] section of the disklabel reads:

    : type: SCSI
    : disk: SCSI disk
    : label: ATLAS10K3_18_WLS
    : flags:
    : bytes/sector: 512
    : sectors/track: 578
    : tracks/cylinder: 2
    : sectors/cylinder: 1156
    : cylinders: 31022
    : total sectors: 35916548
    : rpm: 10021
    : interleave: 1
    : trackskew: 0
    : cylinderskew: 0
    : headswitch: 0 # microseconds
    : track-to-track seek: 0 # microseconds
    : drivedata: 0


    thanks,
    butting

  2. Re: Merging partitions with disklabel/growfs


    Bryce Utting wrote:
    > Okay, I guess disklabel and growfs don't work quite the way I

    thought.
    >
    > Summary: I've got a second hard drive (sd1) partitioned a-k, with

    sd1h
    > in use. I'd like to merge sd1{d,e,f,g} and sd1{h,i,j,k} to single
    > partitions. I think I've at least merged sd1{i,j,k} to sd1i using
    > disklabel -e, but growfs sez "unknown device" even though mount, fsck
    > and newfs (-N) have no problems.


    it was a bug that's since been fixed. you can find a small patch in
    cvsweb pretty easily.

    > First question: are there any obvious flaws in this strategy?


    no, it should work.

    > Second question: how *exactly* should disklabel be used to reallocate
    > sd1i? I'd dive in with -E but the manpage warns:


    Use -E. It's easier and does some better error checking.


  3. Re: Merging partitions with disklabel/growfs

    tedu wrote:
    >> Okay, I guess disklabel and growfs don't work quite the way I thought.
    >>
    >> Summary: I've got a second hard drive (sd1) partitioned a-k, with sd1h
    >> in use. I'd like to merge sd1{d,e,f,g} and sd1{h,i,j,k} to single
    >> partitions. I think I've at least merged sd1{i,j,k} to sd1i using
    >> disklabel -e, but growfs sez "unknown device" even though mount, fsck
    >> and newfs (-N) have no problems.

    >
    > it was a bug that's since been fixed. you can find a small patch in
    > cvsweb pretty easily.


    .... ah! Thank you, that's -very- useful. I shoulda googled on the
    error message instead of for more instructions on disklabel/growfs.

    I should also put the 3.5 CDs I've had sitting around for over five
    months to use...

    >> Second question: how *exactly* should disklabel be used to reallocate
    >> sd1i? I'd dive in with -E but the manpage warns:

    >
    > Use -E. It's easier and does some better error checking.


    Will do.


    thanks!
    butting

+ Reply to Thread