shrink /usr size

Matthew Seaman m.seaman at infracaninophile.co.uk
Thu Mar 18 09:58:02 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 18/03/2010 09:36:44, Aiza wrote:
> /usr is the last partition in the slice. It has 15GB and only 600mb
> used. I would like to shrink /usr to 7GB leaving me 7GB for another new
> partition for mysql DB testing. How do I shrink /usr?

Backup the contents or /usr to a different partition, or preferably to
some external media.  Unmount /usr and destroy it by using bsdlabel(1)
to create two appropriately sized partitions in its place.  Create
filesystems on the new partitions using newfs(1).  Restore the backup of
/usr.  Edit /etc/fstab as appropriate and mount the new partitions.

Everything you really need to do this is on the root partition, but you
might find lack of vi(1) and various other utilities somewhat
inconvenient.  Also editing the label of a disk with mounted partitions
is a pretty risky operation and forbidden by default: you will need to
know the magic incarnation:

    sysctl kern.geom.debugflags=16

Also, there's no real reason to keep the mysql data in its own partition
- -- if it was on a different disk that would be a different matter -- so
if your /var is big enough, you could just swap /var and /usr, which
saves you all that mucking around with partitions.

	Cheers,

	Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuh+L8ACgkQ8Mjk52CukIzTxwCfWuPe6vDdoQIvbiQFxoLTp/Wu
PIAAn1YhLHwzKfcJF4BPssNt6WgvdXTN
=2DGA
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list