Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jun 2003 07:20:48 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Roger Merritt <mcrogerm@stjohn.ac.th>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Can I delete a partition (or is it a slice?)
Message-ID:  <20030616062048.GB19062@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <5.2.0.9.0.20030616120100.00a47500@127.0.0.1>
References:  <5.2.0.9.0.20030616120100.00a47500@127.0.0.1>

next in thread | previous in thread | raw e-mail | index | archive | help

--CUfgB8w4ZwR/yMy5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 16, 2003 at 12:11:25PM +0700, Roger Merritt wrote:
> I have a chance to get my hands on a 4-GB hard drive that's being replace=
d=20
> by a 40-GB drive. My other machine really needs more space (it also has a=
=20
> 4-GB drive), and I'd like to move the /usr/home slice (or is it partition=
?)=20
> to the new(er) HDD and delete the /usr/home slice from the older drive. I=
=20
> presume the space would then be available to the /usr partition (the two=
=20
> are adjacent and /usr/home was created after /usr). Would deleting the=20
> slice cause my partition table to be rewritten with disastrous results?

So long as the /usr/home partition follows the /usr partition, you
should be able to merge the two by judicious use of 'disklabel -e'.
Then use growfs(8) to expand the filesystem into the new space.  If
the partitions are ordered the other way round then you're pretty much
going to have to backup the /usr partition to tape, wipe both the /usr
and /usr/home partitions, rebuild the filesystem on the merged area
using newfs(8) and restore from the backup.

Of course, wiping out the /usr partition will remove a large number of
tools that you might need for doing the backup and restore.  You can
do this using only the tools available in /bin and /sbin --- ie. use
dump(8) and restore(8), but you might find it easier to boot from disk
2 of the install media -- the live filesystem image -- and mount your
harddrives from there.
=20
> Or would it be better to set up three slices, for /, /var, and /usr, on t=
he=20
> new drive, transfer the data from the old drive with backup and restore,=
=20
> backing up the contents of /usr/home to a tarball on the new drive, then=
=20
> repartition the old drive with a single slice, /usr/home, and copy the=20
> backup tarball?

That will work too, at the cost of some juggling the disks around so
that everything remains bootable.  If you're moving the root
partition, make sure that you set up /etc/fstab with the correct
device names before you try and reboot.  Or copy the /, /var and /usr
partitions, and then rejumper and swap master and slave disks.
Recovering from an incorrect fstab is painful.
=20
> Also, since these two drives would be on the same cable, would using tar =
to=20
> transfer the data be faster than backup and restore?

No -- any differences in speed between different utilities are going
to be inconsequential compared to other considerations: tar(1) lives
in /usr/bin, which is part of what you're going to be modifying.
Better to use tools from outside that area.

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

--CUfgB8w4ZwR/yMy5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE+7WHAdtESqEQa7a0RAqj6AJ99MlReFvcKdtU3EDXLwMzfOFvN8wCeNstI
soMn4K6NVbQUvMmqvyCpxjw=
=Ne7H
-----END PGP SIGNATURE-----

--CUfgB8w4ZwR/yMy5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030616062048.GB19062>