The main hard disk where webmin is installed is going out of space.
so the question is : how to move all website directories to another disk with more space or change home dir fo newly created websites to another disk so to use the available space disk?
I tried changing {HOME} with new directory in server templates but it is ignored when the new wbesite is created.
or hwo to chagne {HOME} variable?
best regards
Copy the data from /home to your new disk (make sure you use the right options to preserve ownership, links, and hidden files, and permissions, so use the -a flag for rsync or cp), and mount it on /home. That’s it. That’s the only reasonable answer.
Changing where homes live is a recipe for problems down the road. At some point you’re going to forget what you did, or try to use a script that expects homes to be in /home or whatever. There is no good argument for making a mess when there is a clean and simple solution, that’s actually less work than changing paths.
To be very specific:
Before making any system changes, do your regular backups. You are keeping regular backups, right? At least make Virtualmin backups, but maybe also do a full system backup, maybe via a system image at your hosting provider. Most virtual machine hosting providers offer a way to snapshot the system, which provides a full filesystem backup that you can revert to if something goes wrong.
Then:
Stop all services that could cause writes to home (just mail, probably, but you might have web apps that could do it, too, if they accept uploaded files or something) for the duration of the migration so you don’t lose data.
Mount the new disk on something like /mnt/newhome.
Copy all of /home/* (but don’t copy the directory /home itself. You want to be able to mount this new disk on /home, and you don’t want things to be in /home/home.
Unmount /mnt/newhome. Mount the partition/volume onto /home.
Test.
If everything is good, unmount /home so you can delete the old data to free up disk space on /.
Add the new home to your /etc/fstab, and mount it.
You’re done. Remember this is an administrative task, so you’ll need to do it all as root.
If you need more convincing about doing it the right way (which is just as easy as doing it the wrong ways), search the forum, we’ve discussed this topic many times.
I didn’t see it listed, but I didn’t carefully read everything, your backup strategy may, or may not, follow symlinks. I think this is mainly a safeguard against infinite recursion and duplication.
Joe is absolutely correct. Another way is to clone the drive into the bigger one. Something like Clonezilla should do the trick. Then just swap the connection positions in the computer’s system, or remove the smaller one altogether. The OS shouldn’t know anything changed when booting back up, but that it now has more room. Let us know how it comes out either way, and good luck.
Does clonezilla backup live files like for example mariadb database?
If cloning i need to clone the machine while working i cant stop services for a long time
Thanks.
The cloning of a drive is best performed by shutting down the system and using another system to clone the drive. Plug the old drive and the new drive into the other system, and then perform the clone. That way the servers drive is not active and no processes are in play on it. Once the clone process is completed, shut down the working system and remove the two drives. Take the new, larger drive and place it back into the server system and reboot. At this point your server is back in operation just as it was but with all the space you desired going forward.
As I said, this is one way to do the job. If following this method, one is perfectly safe in performing the cloning process.
One should also bear in mind that using a larger and separate drive for data store is best. That way the original boot drive just needs room for the main OS and nothing more.
Further, whenever maintenance is needing to be done on hardware, a system is always needing to be shut down. In the situation where something cannot be interrupted, then parallel systems must be in place. Proper advance planning must be considered before starting up a server environment.