problem of expanding /usr

hi,

my FreeBSD box is build on VMware Fusion, the /usr dir seems not enough space to use, so i have increased the cap of HD for BSD in VM. i just know to use fdisk in sysinstall to add an additional HD, however, i only want to expand the cap of /usr. howto? any ideas?

Thanks
 
Do you want to resize /usr? If so use growfs(8). However chances are high that you do not prepare it for such option in advance. We can provide more info if you run df -h.

Another option is some parts some parts of /usr elswhere and symlink back to the normal position in /usr. In particular the /usr/ports and /usr/src trees.
 
I use separate partitions for /usr/ports/, /usr/src/ and /usr/obj.

Another one I quite frequently set aside is /usr/home.
 
I don't know how to enlarge the hd in vm so that I usually add a another hd in freebsd which will be ad1 as default. then format the new disk.
Code:
# fidsk -BIq /dev/ad1
# bsdlabel -w -B /dev/ad1s1 auto
# newfs /dev/ad1s1a
boot to single user
Code:
# reboot
# boot -s
# fsck
# mount -a -t ufs
# mount /dev/ad1s1a /mnt
# cd /mnt
# dump -0af - /usr| restore rf -
# umount /mnt
set the fstab, if the /usr slice is ad0s1e
Code:
# sed -I .bak 's/ad0s1e/ad1s1a/' /etc/fstab
# reboot
# tail -f /var/log/messeges
# rm /etc/fstab.bak
# rm /var/restoresymtable
 
hi,

First of all, thanks all of u with kindly help, fortunately the problem have been solved.
i spend a whole morning to google and go through the man pages of fdisk, bsdlabel and growfs. Following is the procedure step by step:

1) reboot system then go to single user mode.
2) use fdisk to enlarge the slice which i want to expand.
3) exit let the system boot again.
4) use bsdlabel to edit which partition size (i just use one and whole partition for /usr) i want to expand.
5) force umount /usr.
6) use growfs to enlarge /usr.
7) run fsck.
8) mount /usr again. Bingo!

Its just an experiment for my BSD box, of course, if you are in production environment, backup is necessary.

Thanks
 
Back
Top