I am setting up a LAMP server for my home LAN. I want to move the data out of / into a new disk partition for ease of backup and especially away from any clean installation I might do. What I have in mind:
Shut down MySQL and Apache
Make a new partition, format as ext4
Mount new partition on /mnt
Copy all of /srv to /mnt
Copy MySQL stuff from /var/lib/mysql to /mnt/mysql
Update /etc/my.conf to point to /srv/mysql
Unmount /mnt
Update /etc/fstab to mount new partition on /srv
mount /srv
Start mysql, apache
Will a fresh install or upgrade keep its fingers out of /srv, in the same way as /home?
Or will those parts of apache installed in /srv/www be updated?
What have I forgotten? Any words of wisdom on this project?
Should be fine. The example pages in /srv/www/htdocs belong to apache2-example-pages and might get updated if the package is but as long as srv is mounted it should be fine.
> Will a fresh install or upgrade keep its fingers out of /srv, in the
> same way as /home?
Install, depends on you. You have to say “no” to format it.
Upgrade, yes, of course, it will be used and upgraded. Mysql tables are usually updated to the new
version of the server. Apache, similar things. Your own documents should remain - but as I always
say, do a full backup regardless of update/install method.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
Yes, install won’t format the new /srv partition unless you tell it or forget to select custom partitions.
Sounds good and you’re also making configuration changes to MySQL configuration files.
**Not sure what the naming will be in step 6, ** just moving /var/lib/MySQL to some place on /srv so MySQL needs to know what that will be. **
I assume Apache needs the same, **ie, /var/llb/apache2 because of /srv/www ? How about /srv/ftp and anything else on /srv?
If you copy/move both /var and /srv to /mnt then its not a problem.
After validating no harm, no foul, remove original /srv and /var directories?
For this I just had to modify one line in the [mysqld] stanza of /etc/my.conf:
datadir = /srv/mysql
**
I assume Apache needs the same, **ie, /var/llb/apache2 because of /srv/www ?
No problem with apache, as it already was pointed at /srv/www
How about /srv/ftp and anything else on /srv?
If you copy/move both /var and /srv to /mnt then its not a problem.
After validating no harm, no foul, remove original /srv and /var directories?
I’ll probably just leave them in the / partition unless I really get low on space there. I just wanted to make sure the new content went into /srv.