On Thu, 6 Jan 2005, Paul W. Abrahams wrote:
On Thursday 06 January 2005 6:01 pm, B. Stia wrote:
Going to have a problem soon. My /usr partition is 94% full. (didn't realize that /usr/lib_64 was over 300 megs alone) When I originally setup my system I created several large partitions, some of which have lots of space.
I've set up several SuSE systems, and for a long time I thought it was wise to have separate partitions for the separate top-level partitions (/usr,/var,/home, etc.). But my experience now is that it's better to put everything in one partition to avoid precisely the pickle you're in -- one partition grows unexpectedly while the others still have plenty of room left.
I think the idea of having separate partitions for separate components of the top-level filesystem is really a historical remnant of the days when you needed to distribute the filesystem over several hard drives because a single drive wasn't big enough. Those days are gone. I know there's a case to be made for having /usr, say, mounted read-only so people don't muck with it, but really, you can do just as much by setting the permissions properly.
Maybe I'm missing something here. I'd like to hear other opinions.
There IS an even better option. Use LVM. I haven't set up a Linux box
without LVM in... years. Personally, I use a *small* /boot (maybe
100M), and the one of the two following scenarios (let's say I've got
/dev/hda):
/dev/hda1 /boot 100M This is the boot partition.
/dev/hda2 SWAP xxxM Swap
/dev/hda3 / 500M This is / (aka, 'root')
/dev/hda4 LVM REST This is the first "pv" for LVM
I create a Volume Group (aka, "block device") out of /dev/hda4.
Then, I create logical volumes (aka "partitions") from the Volume Group.
If I were to name my LVM "system", here is what I might do:
/dev/system/usr /usr 750M
/dev/system/var /var 750M
/dev/system/tmp /tmp 1.0G (also symlink /var/tmp and /usr/tmp -> /tmp)
/dev/system/opt /opt xxxM
/dev/system/usr_local /usr/local xxxM
/dev/system/multimedia /multimedia (shared multimedia) xxxM
and so on.
Later, if I find that 750M is not enough for /usr (and I'm using a
reasonable filesystem like ext2/3, jfs, even reiser can be enlarged
!! NOTE: ext2/3 can also be shrunk!!), I go into single-user mode
('init 1' or 'telinit 1', etc...), and then issue the following
commands.
For jfs:
Do not unmount.
Enlarge the "partition" (logical volume):
lvresize --size=+500M --test /dev/system/usr
!! The plus ('+') is very important.
If that looks OK, then I reissue without --test.
Remount:
mount -o remount,resize /usr
jfs will automatically enlarge to the size of the LV.
For ext2/3:
Bear with, it's been a while.
Unmount
use resize2fs
mount
For reiser/xfs/other? Dunno. Don't use them.
Now, obviously your volume group has to have space available, but
hey, with today's disks, that's not usually a problem. Or, go buy
another disk, add it to the volume group, and then add. /dev/hda only a
5G and you need 30G of space over 3 filesystems? Buy another drive and
use LVM.
I use LVM on top of raid5 or raid1.
--
Carpe diem - Seize the day.
Carp in denim - There's a fish in my pants!
Jon Nelson