Lack of space in /usr

Greetings all,

I am struggling with my first desktop-based installation of FreeBSD; this is actually my first post from the install. Since my / and /usr are UFS-based, and I have misjudged the size for /usr
Code:
Filesystem           Size    Used   Avail Capacity  Mounted on
/dev/label/rootfs    989M    493M    417M    54%    /
devfs                1.0K    1.0K      0B   100%    /dev
/dev/label/usr       4.8G    1.7G    2.8G    37%    /usr
basefs               116G     18K    116G     0%    /basefs
basefs/var           116G     54M    116G     0%    /var
/dev/md0             496M     12K    456M     0%    /tmp
, I was wondering what could be done. Examining the
Code:
/etc/portsnap.conf
I noticed that there is a possibility to relocate the location of the ports tree
Code:
PORTSDIR=/usr/ports
What would be the consequence of relocating the PORTSDIR elsewhere, e.g.,
Code:
/home/ports
or its own file-system?

Could I do similar trick/hack with the default locations of the target directories defined in
Code:
/usr/share/examples/cvsup/standard-supfile

If so, what would be the practical steps? Should I just delete the existing directories and re-run cvsup and portsnap?

Thank you,

M
 
You can probably relocate the ports tree and put the build directories somewhere other than the default.

But where are you planning on installing the applications built from ports? The default is /usr/local!

You've got plenty of space, just allocate it less weirdly. If you're worried about space conservation, /var, /tmp, and /usr don't have to be separate filesystems. Some people just put it all on /. For your setup, I'd do 1G /, at least 2G swap, 1G /var, at least 1G /tmp, and at least 20G for /usr, probably the rest of the disk.

(Why the sizes? 1G minimum for any filesystem, it's enough room to do something and hold an ISO image for a restore disk in an emergency. Relatively large swap because the HTML5 stuff in Firefox seems to want a lot of space when compiling a few steps. Large /usr because it needs it.)
 
I have been using /home/ports/ for the ports tree for a couple of years now. I just symlink it to /usr/ports. I also set "WRKDIRPREFIX= /home/tmp" to avoid pollution (I can just # rm -r /home/tmp/ports/ to clean all the work directories, if I wish).

So far it hasn't caused any problems.
 
Dear wblock,

I actually have an allocation similar to your suggestion: / is 1GB, swap 4GB, /tmp 0.5GB, /var and /basefs, including /basefs/home are on zfs.

My only problem is /usr because I am still not comfortable enough with zfs to put OS-related files on it, and on servers the 4-5GB for /usr was more than enough. As I noted, this is my first desktop and I did not realize the space requirements.

Can I somehow save all what I have done so far, i.e, by copying it on a different hard-drive, re-format, and copy back?

Dear fronclynne,

thank you for the advice, this is what I had in mind.

Kindest regards,

M
 
How about moving /usr/local to its own filesystem?
This should leave you with enough space on /usr and also it would appear logical to me, as nothing base-OS related lives in /usr/local.
 
Dear mickey,

I really like this idea. Can you advise how do I do it practically? Is it as simple as creating new file-system /usr/local and copying the content of the original /user/local there and deleting the original /usr/local?

Kindest regards,

M
 
mefizto said:
I really like this idea. Can you advise how do I do it practically? Is it as simple as creating new file-system /usr/local and copying the content of the original /user/local there and deleting the original /usr/local?

I would perform it something like this:
  • Temporarily disable all non base-OS startup options in /etc/rc.conf and reboot the machine, so that nothing will access /usr/local anymore. Alternatively you might use single-user mode for this, if you feel like doing so.
  • Create a new filesystem and mount it onto /mnt
  • Copy over the contents of /usr/local to /mnt keeping all permissions intact, i.e.: (cd /usr/local; tar -cf - .) | (cd /mnt; tar -xpf -)
  • Rename /usr/local to /usr/local.old
  • Create an empty directory /usr/local as a mountpoint for the new filesystem
  • Edit /etc/fstab and add an entry that mounts your new filesystem onto /usr/local
  • reboot
  • If everything went well, you can delete /usr/local.old and re-enable your startup options in /etc/rc.conf
 
Depending on how your partitions are laid out, growing the partition with 'growfs' might be an option.

If your /usr partition is followed on disk by another partition that you can feasibly backup and delete temporarily (/home for example), then you can resize your /usr partition into that space, then use 'growfs' to expand the UFS filesystem within the new space.
 
Dear mickey,

thank you for the detailed instructions, I will give it a try.

Dear jem,

the ufs formatted /usr partition is followed by the zfs formated basefs partition. I do not know if I can resize/turn part of it into ufs.

Kindest regards,

M
 
Just for reference:
Code:
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad0s1h    3.9G    477M    3.1G    13%    /usr/ports
/dev/ad0s1g    2.4G    1.6G    688M    70%    /usr/obj
/dev/ad0s1f    989M    520M    390M    57%    /usr/src
The size of /usr/ports is without distfiles, packages and work directories (I store those separately).
 
Dear SirDice,

could you - for a future reference - post your hard drive organization, i.e., where do you store the distfiles, packages and work directories?

I keep wondering whether I should not re-install, since I do not have much applications/data on the laptop yet, and perhaps doing so would be cleaner than attempting various patches of bad initial planning. My hard drive size is 150 GB.

Kindest regards,

M
 
mefizto said:
Dear SirDice,

could you - for a future reference - post your hard drive organization, i.e., where do you store the distfiles, packages and work directories?
I can. It's somewhat complicated though and I really need to reorganize.
Server:
Code:
dice@molly:~>df -h
Filesystem                            Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a                           496M    102M    354M    22%    /
devfs                                 1.0K    1.0K      0B   100%    /dev
/dev/gvinum/temp                      5.8G    676M    4.7G    12%    /tmp
/dev/ad0s1d                           989M    155M    756M    17%    /var
/dev/ad0s1e                           3.9G    544M    3.0G    15%    /usr
/dev/ad0s2g                            15G     39M     14G     0%    /usr/home
/dev/ad0s1f                           989M    520M    390M    57%    /usr/src
/dev/ad0s1g                           2.4G    1.6G    688M    70%    /usr/obj
/dev/ad0s1h                           3.9G    477M    3.1G    13%    /usr/ports
/dev/ad0s2d                           2.9G    371M    2.3G    14%    /jail/j1
/dev/gpt/backup2                      1.8T    1.3T    339G    80%    /storage
/dev/gvinum/raid5                     1.3T    1.1T    162G    87%    /mnt
/storage/Movies                       1.8T    1.3T    339G    80%    /jail/j1/exports/Movies
/storage/FreeBSD                      1.8T    1.3T    339G    80%    /jail/j1/exports/Freebsd
/storage/Software                     1.8T    1.3T    339G    80%    /jail/j1/exports/Software
devfs                                 1.0K    1.0K      0B   100%    /jail/j1/dev
/dev/ad0s2e                           5.8G    2.7G    2.7G    50%    /jail/j2
/tmp/build                            5.8G    676M    4.7G    12%    /jail/j2/tmp/build
/usr/ports                            3.9G    477M    3.1G    13%    /jail/j2/usr/ports
/storage/FreeBSD/distfiles            1.8T    1.3T    339G    80%    /jail/j2/usr/ports/distfiles
/usr/src                              989M    520M    390M    57%    /jail/j2/usr/src
/usr/obj                              2.4G    1.6G    688M    70%    /jail/j2/usr/obj
devfs                                 1.0K    1.0K      0B   100%    /jail/j2/dev
/storage/FreeBSD/packages_20100727    1.8T    1.3T    339G    80%    /jail/j2/usr/ports/packages

My workstation looks like this:
Code:
dice@williscorto:~>df -h
Filesystem                      Size    Used   Avail Capacity  Mounted on
/dev/ad4s2a                     496M    133M    323M    29%    /
devfs                           1.0K    1.0K      0B   100%    /dev
/dev/ad4s2e                     5.8G    163M    5.2G     3%    /tmp
/dev/ad4s2d                     989M    102M    809M    11%    /var
/dev/ad4s2f                     5.8G    2.1G    3.2G    39%    /usr
procfs                          4.0K    4.0K      0B   100%    /proc
linprocfs                       4.0K    4.0K      0B   100%    /usr/compat/linux/proc
/dev/ufs/cortohome               71G     18G     47G    28%    /usr/home
molly:/usr/ports                3.9G    477M    3.1G    13%    /usr/ports
molly:/usr/src                  989M    520M    390M    57%    /usr/src
molly:/usr/obj                  2.4G    1.6G    688M    70%    /usr/obj
molly:/storage                  1.8T    1.3T    339G    80%    /storage
 
Back
Top