Moving Scalix /var/opt/scalix/data folder
Posted: Tue Dec 06, 2005 11:53 am
by BigBirdy
We are running out of space on a RHES4 server which unfortunately was not created with LVM partitions so I need to move the data directory. Can I simply do the following to move the data directory?
1: Create a new folder on a large partition, mkdir /mnt/newfolder
2: Shutdown Scalix
3: cp -p /var/opt/data /mnt/newfolder/
4: mv /var/opt/scalix/data /var/opt/scalix/data.bak
5: ln -s /mnt/newfolder /var/opt/scalix/data
6: Restart scalix
Is there no omdiskspread with Scalix?
Posted: Tue Dec 06, 2005 10:34 pm
by deyjvu
Openmail had a command omdiskspread that did the spreading of ~/data across a bunch of directories automagically. Is this command available in some other form with Scalix?
Posted: Wed Dec 07, 2005 5:24 am
by jch
omdiskspread is still there, but it's not been tested or used in a long time. With very large file systems available the only real use for omdiskspread is removing the potential hot spots of the file system journal and the superblock. But that's getting well away from the topic...
I'd do what was suggested slightly differently depending on what's available.
First, however, some fire fighting. Do you have a lot o stuff in ~scalix/tmp and/or ~scalix/temp? If so, shut down scalix and delete anything that's, say, more than three days old. Our development systems often get loads of rubbish in those directories as we tend to log all sorts of stuff that normal people wouldn't want to see.
On to the main event.
The best option would be if there's an available partition or unused space on the disk. If there is, set up the space as an LVM partition and set up LVM on it (if you want to do that and don't know, please ask). Copy your entire /var/opt/scalix into a new logical volume.
If you don't have the disk space available, then it's probably best to move all of /var/opt/scalix to somewhere else, eg
cp -a /var/opt/scalix /somewhere/with/lots/of/room
mv /var/opt/scalix /var/opt/scalix.save
mkdir /var/opt/scalix
mount --bind /somewhere/with/lots/of/room/scalix /var/opt/scalix
Note, "cp -a", not "cp -r" (see the man page). Actually, I don't entirely trust cp still, so I'd do
(cd /var/opt; tar cf - scalix) | (cd /somewhere/with/lots/of/room; tar xpf -)
which I'm much happier with as I've been using it for years.
The "mount --bind" is a very efficient way of making one directory visible in another place and efficient is good here as files are very often named with their full path name. You can add en entry to fstab to make this permanent, eg
/var/opt/scalix /somewhere/with/lots/of/room/scalix none bind 0 0
(I think I've got that right, the type is "none" and the options are "bind".)
You can move just the data directory if you prefer, but it's probaly best to move the entire thing as it generally makes backups easier to manage and admin simpler.
jch