Partitioned HD and disk space

torp

Verified User
Joined
Jul 6, 2004
Messages
129
Location
Oslo
When my server was set up, it was formatted with one partition at / and one partition at /home/. Now, my root partition is 99% full, whereas my home partition is only 60% full. This is probably due to databases, emails and logs being on root.

How can I safely move this information over to the home partition? Any suggestions?

(i.e. is it safe to create a symlink from i.e. /var/spool to /home/spool so that emails are on home partition, even when they are saved on /var/spool/?)
 
While I don't think of it as safe, short of rebuilding your system there's not much else you can do now.

When doing that be sure to move the data (all of it, including hidden files) over to the new directories) before deleting those directories and creating the links.

For example:
Code:
# mkdir /home/varspool
# mv /var/spool/* /home/varspool/
# cd /var
# rmdir spool
# ln -s /home/varspool/ spool
Note that I take no responsibility for errors in the above; I have NOT tested it and it could be full of typographic or syntactic errors. You should check to make sure all the data has been moved before running the rmdir spool command and if it gives you an error then you should not proceed until you determine the problem.

You should definiely reboot the server after doing this, as otherwise any open files (for example logfiles) will continue to be written to the old location.

Note again: This is NOT tested; try it yourself on a non-production system. It may break everything. Be sure to have a full backup before trying this.

Jeff
 
Thanks Jeff! Don't know if I dare attempt this, but thanks for reminding me to reboot the server straight after the linking.
 
I'm going to add for the sake of the archives that I know and understand that there's nothing here that requires a complete server reboot. But to do this without a server reboot you'd have to find and close and reopen every file open on /var/spool.

Rebooting is easier and would probably take less time :) .

Jeff
 
I have tried the folowing

Shutdown exim and vm-pop3d

#mkdir /home/varspool
#cp -R /var/spool/* /home/varspool/
#cd /var
#mv spool spool-old
#ln -s /home/varspool/ spool
#rm -r mail
#ln -s /home/varspool/mail mail

Chmoded and chowned accordingly

Restarted the server

The result is that i could open existing e-mails but not send or accept them ( using webmail ), any ideas ?
 
Last edited:
I dont think that cp -R preserves the right permissions of files and folders.

mv may have preserved them but I dont think cp -R will.

If you did cp -rfp or cp -Rp it probably would of been ok.

I have created a program to fix permissions of /var/spool/virtual.

Do this is root to fix your permissions of that folder.

Code:
cd /var/spool/virtual
wget -O rebuild [url]http://andrewk.net/da-files/rebuild-spool[/url]
chmod 750 rebuild
./rebuild

As for the other folders and files in /var/spool you will have to redo those manually.
 
It was all about the cp -rp, everything seems to be working fine for now.

I didn't use the script though.

Thanks alot.
 
Back
Top