Expanding space on the root partition

Q I had SUSE 9.2 installed on a new computer, and since the full install needed about 5GB, I reserved 6GB for the root partition and the rest of my hard disk for /home. Having OpenGroupware.org installed and a few other things that reside in /var, /opt or /usr, I'm running out of space in the root partition. I thought (being a photographer and storing all my pictures in my home partition), it would be a good idea to have a second hard disk installed as backup for my pictures and as an extension for my root partition. I want to divide the new hard disk into two partitions. One partition should be an exact and frequently renewed copy of the /home/mydir/mypictures_directory. The other partition should be the new /usr directory (containing the old /usr directory and files from the original root partition). Any suggestions on how to do this?

A Use YaST to partition your new drive into two partitions and format them with your filesystem of choice. If in doubt, accept the default of ReiserFS. It is vital that you set your new partition to be mounted at /newusr, not /usr, or you could stop your system working. Then do the following as root:

rsync -a /usr/ /newusr/
umount /newusr
rmdir /newusr

Load /etc/fstab into your favourite editor and change the entry for /newusr to /usr and type mount /usr. You are now using your new /usr partition, and need to remove the contents of the old /usr directory with

mkdir /tmp/root  mount --bind / /tmp/root
rm -fr /tmp/root/usr/*
umount /tmp/root
df -h / /usr

The last command should confirm that / now has plenty of free space. If you feel that you might need to alter your partitioning again, you should consider using LVM to handle your partitioning. You'll find full details are at www.tldp.org/HOWTO/LVM-HOWTO/index.html. To keep an up-to-date mirror of your mypictures directory, I recommend rdiff backup from www.nongnu.org/rdiff-backup. In addition to keeping a mirror, it also holds older versions of files you have deleted or altered - ideal if you change your mind. You can run it from a cron task to make the backups as frequently as you like. For example, you could save the following as a script in /etc/cron.daily:

#!/bin/sh
rdiff-backup /home/mydir/mypictures
/mnt/backup/mypictures

Back to the list