moving /home /root & /var to new partition
I have only 4.2G on my / partition (hda8) & am constantly running out of space, however I have a now empty 3.0G partition (hda5) so I want to move /home, /root and /var to hda5.
I have copied /home/crashedagain (the only user) to hda5 & mounted it via fstab as /home. (fstab entry: /dev/hda5 /home ext3 auto,users,exec 0 0). This seems to be OK & is now working.
Now I want to move /root and /var. These will now become /home/root and /home/var since the partition is mounted as /home.
Since the system expects to find /var not /home/var, can I just replace /var with a symlink to /home/var.
I have read that some applications will not follow symlinks.
Will there be problems with using a symlink here?
If so, what is the alternative?
You need to create a separate partition for every out-sourced part of the root-tree. Although I have never tried your symlink solution, I can't imagine that this will work without trouble.
How big is your var? Is there really a point in moving it at all? I think mount also has an option to move part of the filesystem to another place (--bind option?), see man mount for this.
It's not really that big (about 400M at the moment) but sometimes it needs a lot of space, for instance apt-get upgrade (Debian system) can download as much as 500 or 600M of .deb files. These can be cleaned up once the upgrade is done but it needs the space with it is doing the upgrade.
400 MB seems a lot to me, mine is 17 MB :D I think you could make it happen with mount --bind so that you don't have to start partitioning hda5. Partitioning would seem a bin inconvenient.
crashedagain@desktop:~$ sudo du -s /var
most of it is in /var/lib & /var/log:
crashedagain@desktop:~$ sudo du -s /var/*
most of /var/lib is apt & dpkg but there are a couple of really big files in /var/log:
crashedagain@desktop:~$ ls -ls /var/log | sort -n
3436 -rw-r----- 1 root adm 3514197 Oct 20 06:33 syslog.2.gz
6556 -rw-r----- 1 root adm 6698794 Oct 20 06:33 messages.0
60720 -rw-r----- 1 root adm 62108905 Oct 20 04:54 debug.0
68892 -rw-r----- 1 root adm 70467752 Oct 20 06:25 kern.log.0
If I can get rid of these (and set the system up to keep them from growing...130Meg in log files is ridiculous!) then var will be small enough it won't be worth moving. I think logrotate is what cleans them up but I haven't figured out how it works yet.
It has it's own configfile in /etc/ called logrotate.conf that defines how often the logs should be rotated and for how long the old logfiles should be kept. I have:
Oh, and check the logging settings of your firewall, it can quite quickly bloat the logs, could be the reason for the size of your kern logfile. What goes into debug in your system?
That's pretty much what mine looks like too except I had rotate 5 so I had 5 .gz compressed old files for most logs instead of 1.
But the 60+ Meg files debug.0 and kern.log.0 were dated Oct 20 so why weren't they rotated? Does rotate work on ALL log files in /var/log or is it necessary to specify which ones get rotated? The manpage doesn't say.
I manually removed them & recreated empty files so as to avoid something looking for them & giving an error.
Drive space is probably OK now:
Filesystem Size Used Avail Use% Mounted on
/dev/hda8 4.2G 2.6G 1.4G 67% /
/dev/hda1 4.6G 3.0G 1.6G 66% /mnt/hda1
/dev/hda5 3.0G 791M 2.1G 28% /home
/dev/hda7 26G 8.9G 17G 36% /mnt/hda7
/dev/hdb1 25G 301M 23G 2% /mnt/hdb1
/dev/hdb2 50G 20G 28G 42% /mnt/hdb2
hda1 is windows, hda7 is vfat & hdb is a data drive. but with 1.6G free on hda8 I should be OK, Previously I had about 90% full on this drive.
You probably shouldn't move /root to a new partition. The reason /root is put on the root filesystem is so that if there's a boot problem and Linux is unable to mount any other partitions besides the root partition, then root can still get to all his files. If /root is on a separate partition, he'll still be able to log in in that case, but won't have any access to files in his home dir.
|All times are GMT -5. The time now is 09:18 AM.|