Can I delete a partition (or is it a slice?)

Matthew Seaman m.seaman at
Sun Jun 15 23:21:01 PDT 2003

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 replaced 
> by a 40-GB drive. My other machine really needs more space (it also has a 
> 4-GB drive), and I'd like to move the /usr/home slice (or is it partition?) 
> to the new(er) HDD and delete the /usr/home slice from the older drive. I 
> presume the space would then be available to the /usr partition (the two 
> are adjacent and /usr/home was created after /usr). Would deleting the 
> 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.
> Or would it be better to set up three slices, for /, /var, and /usr, on the 
> new drive, transfer the data from the old drive with backup and restore, 
> backing up the contents of /usr/home to a tarball on the new drive, then 
> repartition the old drive with a single slice, /usr/home, and copy the 
> 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.
> Also, since these two drives would be on the same cable, would using tar to 
> 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.

Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP:         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-questions mailing list