Thread: Resizing /usr
View Single Post
Old 8th July 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

yeah as long as you update the /etc/fstab file correctly.


basically some thing like this would *probably* work:

Code:
# fdisk ad0
   ... use fdisk to create the partition from the free space, hence forth called ad0sX
# bsdlabel -e ad0sXa
     ... create the disk label for the new slice
# newfs /dev/ad0sXa
# mount /dev/ad0sXa /mnt
# tar -cf - -C /usr . | tar -xvpf - -C /mnt
   ... copies files over
vi /etc/fstab
   ... change the device being mounted on /usr
   ... if you have a preferred screen editor instead of vi, feel free to use it
reboot
if the free space partition is ad0s2a (ad0sXa in the above) and your old /usr partition is ad0s3e you would change the ad0s3e to ad0s2a in your /etc/fstab file.

Code:
# mount /dev/ad0sYz /mnt
   .. where ad0sYz was your old /usr partition (e.g. ad0s3e in the above)
# rm -rvf /mnt/*
and do whatever you want with the old partition.



It's not exactly how I would do it but close enough. The reason for the reboot is because you may have programs stored in /usr that are running while doing this and it is best not to delete the data files while running the programs! Rebooting is not necessary but, you could say makes the process simpler to follow without bringing the system to single user mode (which would generally be best imho).



Note: I have not used FreeBSDs 'bsdlabel' in ages and of course assume no responsibility for the accuracy or inaccuracy of any of this.


If your not familiar with using bsdlabel you can always use the -n switch to it which will do a 'dry run' that won't *actually* write changes out, e.g. bsdlabel -ne ad0
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.

Last edited by TerryP; 8th July 2008 at 12:18 AM.
Reply With Quote