How to change mount points
Since you have plenty of room in /home
, move all the stuff from /srv
into /home
, then (optionally) move the stuff that was in /home
to the root partition.
The simplest solution, if you don't mind a few minutes' downtime, is to move /srv
into the larger partition and symlink it:
mv /srv /home
ln -s /home/srv /
If you really want to move /home
to the root partition, then it takes a few renames. I assume there's no directory called /home/srv
or /srv/srv
.
mv /srv home
mkdir /srv
mount --move /home /srv
mv /srv/acme … /home/
mv /srv/srv/* /srv
rmdir /srv/srv
Finally (if you're not using the symbolic link method) edit /etc/fstab
to change the mount point: on the line that begins with /dev/sda9 /home
, replace /home
by /srv
.
Before you do anything you're going to have to figure out a place to keep the 180 megabytes of data that /home is currently taking up. I'd recommend repartitioning the current /dev/sda9 into, say, two gigs for /home
and 42 for /srv
.
Next up you're going to have to be a little tricky. This is all best accomplished in single user mode so that only root is logged on and you don't run into trouble with someone trying to access /home
while you're moving it around.
You've got a decent amount of room in /var, so we'll use that as a temporary holding space:
mkdir /var/tmp/oldhome
cd /home
`tar -cvf - ./ | ( cd /var/tmp/oldhome && tar -xvf - )
Now we've got /home
backed up to someplace while we repartition /dev/sda9
into 2 gigs for /dev/sda9
and 42 gigs for /dev/sda10
Once you've finished repartitioning and creating new filesystems (I'm going to assume you know how to do this) you'll need to edit /etc/fstab
.
Somewhere in there you'll see a line saying something along the lines of
/dev/sda9 /home ext3 defaults 0 2
Assuming that you've made /dev/sda9
the smaller of the two partitions, you can leave that line unchanged; you'll just need to add
/dev/sda10 /srv ext3 defaults 0 2
directly underneath.
Once those lines have been added, simply enter
mount /home ; mount /srv
and check with df -h
to make sure both partitions are mounted.
Then replace the data from /home:
cd /var/tmp/oldhome
tar -cvf - ./ | ( cd /home && tar -xvf - )
Reboot your system in multi-user mode and everything should work.
As a quick but not very beautiful solution, you could remount a directory on one of your less-used disk to some point under /srv
and move something there to clear a bit of space on /srv
proper.
Read about --bind
in man mount
. It boils down to something like mount --bind /some/spare/dir /busy/dir/mountpoint
. It works on any modern Linux.
Suppose that you have /srv/some/stuff
.
mkdir /home/offload/some/stuff
— this is on the 44G free space partitionmv /srv/some/stuff /srv/some/previous-stuff
— temporarily, free up the namemount --bind /home/offload/some/stuff /srv/some/stuff
— now some/stuff is on another partition!mv /srv/some/previous-stuff/* /srv/some/stuff
— put things back under the original name, free up the space on /srv.