Increasing the size of /usr without destroying anything

Hello

On my Mac mini where FreeBSD 8.2 for PowerPC is successfully installed and everything's perfectly working, I need to increase the size of /usr because I want to install more programs than I estimated.

# df -h gives:
Code:
[B]Filesystem     Size      Used     Avail   Capacity     Mounted on[/B]
/dev/ad0s3     581M      164M      371M        31%     /
devfs          1.0K      1.0K        0B       100%     /dev
/dev/ad0s8      44G      234M       40G         1%     /home
/dev/ad0s5     2.1G       14K      1.9G         0%     /tmp
/dev/ad0s7     4.8G      4.0G      479M        90%     /usr
/dev/ad0s6     2.1G      102M      1.8G         5%     /var

You see, /usr is almost full and I can't easily install e.g. Firefox or other programs on it. I 'd like increase the size of /usr at the expense of /home There 's only one file called .snap inside /home


How to do that without destroying any data, anything?

Thanks.
 
aurora72 said:
There 's only one file called .snap inside /home
How to do that without destroying any data, anything?

Perhaps switching /usr with /home would be an option:

1. Copy over everything from /usr to /home

cd /home; dump -C 24 -0af - /usr | restore -rf -

2. Edit /etc/fstab so that /dev/ad0s8 is mounted at /usr and /dev/ad0s7 is mounted as /home

3. Restart the system. The former big home slice should then be mounted at /usr and the former usr slice should be mounted at /home. Once you verified that the new /usr is working well, you can delete the original content at /home.

Best regards

Rolf
 
In your case, by not increasing it at all. When you install ports, which I assume you mean by programms, they get installed into /usr/local by default. So instead of trying to increase the size of /usr by shrinking /home, just move everything from /usr/local to /home and modify /etc/fstab to mount your current /home to /usr/local.
 
One reason to keep /home a symlink to /usr/home. It's even an extended slice for extra confusion power.

The cleanest way is to back up the whole system. Use dump(8) to back up /, /var, /tmp if there's anything to save on it, and /usr. (Really only the last is needed, but...)

With gpart(8), remove s7 and s8 and create a new s7 using that space. newfs and mount that new slice and restore the /usr backup to it. Before you reboot, remove the /home mount from /etc/fstab.

References: Disk Setup On FreeBSD, Backup Options For FreeBSD
 
Hello, all of these are useful ideas and thank you. But,

rolfheinrich said:
Perhaps switching /usr with /home would be an option:
That might be an option but it would be far from ideal because in that case /home would be about 5G in size and I was planning to put a lot of video files at /home, 5G instead of 40G would be no good.

The second advice seems tricky.

The third advice looks the most risky but worth trying, backing up all directories and using gpart(8) to increase the size of /usr. I'll take a look at it.
 
Well, by the most risky I actually meant "the most demanding". To backup, I need to first connect an external HD, and while using gpart one must be very careful.

I have another question about mounting an external HD with NTFS on a FreeBSD Mac mini PowerPC here
 
Hi,

are you installing most things to /usr/local? In that case the easiest thing is just create a symlink from /usr/local to /home/usr/local (or whatever name you want under home).

Otherwise, unmount /home, destroy the parition and create 2 new partitions using that space, say 10GB and 34GB. Copy your usr data to the new usr partion and then mount them as /usr and /home respectively.
You will be left with the old 4GB /usr parition which can be reused for other purposes as you need...

ta Andy.
 
aurora72 said:
Well, by the most risky I actually meant "the most demanding". To backup, I need to first connect an external HD, and while using gpart one must be very careful.

True. An alternative to the external drive is to back up over ssh(1) to another machine on the network.

I have another question about mounting an external HD with NTFS on a FreeBSD Mac mini PowerPC here

Writing to NTFS from FreeBSD is not great. If a Windows system is available, you could put the external drive on it, share it, and mount it on the FreeBSD system with mount_smbfs(8). Windows can safely write to NTFS (because it's "their own dog food").
 
Oh would it be wonderful if we had a volume manager where you could just do a [cmd=]chfs -a size=+2G /dev/whatever

If you once get used to a decent volume manager you sadly miss it. I'm soooo used to start with rather small filesystems and not thinking right now about where I would need the remaining 1 TB of space in let's say 2 years.

FreeBSD needs it! :(
 
oliver@ said:
If you once get used to a decent volume manager you sadly miss it. I'm soooo used to start with rather small filesystems and not thinking right now about where I would need the remaining 1 TB of space in let's say 2 years.

FreeBSD needs it! :(
Correct me if I am wrong, but doesn't ZFS do this? You create a pool, the filesystems and how much space they get. If you need more space then you change the size to what you want/need. This way you do not have to worry about knowing how much space you need for each partition, since there aren't any, when you install FreeBSD or add another drive to your system.
 
I could not get over this problem yet, but it's not because there are not good suggestions, but because making that kind of adjustment seems risky. I have spent almost 1-2 days installing X11, and some other basic ports into /usr/ports/ and I hesitate to increase the size of /usr. And because the system is a PowerPC, I do not have a readily compiled "packages" of the ports somewhere on the Internet. If I had the packages repository somewhere I would go on trying to increase the size of /usr.
 
1... free up space on /usr (delete /work/'s, /usr/ports/packages/, distfiles, ; 2... Use /home for WRKDIRPREFIX so space will be available to build more ports. 3... howsoever, better to get an 80g or greater disk and rsync everything over, I recently did something similar so I no longer have to WRKDIRPREFIX many builds... /usr is 36G here.
 
Back
Top