Re: How to safely merge two slices on harddisk?

From: Malcolm Kay (malcolm.kay_at_internode.on.net)
Date: 02/09/04

  • Next message: Nelis Lamprecht: "Re: builworld failure after cvsup on 4.9"
    To: Rob <nospam@users.sourceforge.net>, freebsd-questions@freebsd.org
    Date: Mon, 9 Feb 2004 22:25:35 +1030
    
    

    On Mon, 9 Feb 2004 13:46, Rob wrote:
    > Hi,
    >
    > I have a hard disk, on which I would like to merge two slices
    > into one single slice. The disk slices are as follows:
    >
    > /dev/ad1s1a 98M 43M 47M 48% /home/userB
    > /dev/ad1s1d 64G 45G 14G 77% /home/userA
    > /dev/ad1s1e 3.0G 2.5G 282M 90% /home/userC
    > /dev/ad1s1f 3.0G 1.0G 1.7G 37% /usr/ports
    > /dev/ad1s1g 3.0G 268M 2.5G 10% /mnt
    > /dev/ad1s1h 295M 295M -23.5M 109% /diskless_swap
    >
    > I want to merge /ad1s1f and /ad1s1g into one 6Gb slice.
    >
    > The merging should NOT destroy anything in the slices before
    > (ad1s1a, d, and e), but destroying the data in the one afer
    > (ad1s1h) is no problem.
    >
    > Is there a way to do this? What is the safest one?
    > (without having to backup the whole disk).

    Any manipulation at this level is risky. To do so without first
    taking a backup endangers all your data.

    But once you have the assurance of a backup you could copy
    all the information from /mnt into some new tree in /usr/ports.
    That is a tree copy of the content of /dev/ad1s1g to a new tree
    on /dev/ad1s1f.
       cp -Rp /mnt /usr/ports/newtree

    Having done that partition /dev/ad1s1g becomes free and you
    can rebuild the disk label using disklabel to eliminate the 'g'
    partition and extend the size of the 'f' partitition to take up the
    extra space. But first umount the 'f' and 'g' partitions.
    CAUTION
    ========
        Do not change the offset of 'f'. If 'g' does not physically
        follow 'f' on the disk then this is not going to work -- give up
        now!!!

    If all has gone well so far you should now be able to use growfs
    on /dev/ad1s1f to expand the file system to fill the partition.

    Remount the 'f' partition and you should be back in business.

    If you want to find what was on /dev/ad1s1g with the original path
    then
       rm /mnt
       ln -s /usr/ports/newtree /mnt

    If you are on 5.x then be warned that I have no experience with
    these versions of FBSD.

    And in any case I have never, myself, had occassion to use growfs.

    Malcolm
    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Nelis Lamprecht: "Re: builworld failure after cvsup on 4.9"

    Relevant Pages

    • Re: good/best practices for gmirror and gjournal on a pair of disks?
      ... Each disk has single slice that covers almost all of the disk. ... slices are combined into the gmirror device, ... Since I'm only gjournal'ing a portion of the underlying gmirror ... Because I'm not journaling the root partition, I chose to ignore the possibility of gjournal marking the mirror clean. ...
      (freebsd-stable)
    • Re: Solaris 8 install, partitioning and VxVM
      ... Do I have to create something in the remaining slices to use up all the ... I need to install Solaris 8 on a V240 with 2-70GB hard drives ... to partition this large drive? ... disk - said I didn't have enought room - but there was a ton of space ...
      (comp.unix.solaris)
    • Re: 2/3 of disk allocated
      ... install. ... You have a disk and installed Solaris ... Don't mix up partitions and slices. ... A partition is an 'fdisk partition' ...
      (comp.sys.sun.admin)
    • Re: disklabel differences FreeBSD, DragonFly
      ... you are not limited to 4 slices * 7 partitions. ... may dd a whole disk image into partition of enough size, ...
      (freebsd-hackers)
    • Re: Linux community software-update-anarchy polemic
      ... Remember, I'm just a monkey. ... That implies that if you have one disk per partition, ... Trust the kernel or don't trust the kernel, but either way, both ...
      (comp.os.linux.misc)

    Loading