Re: Adding a new HDD - how do I move /var/lib/mysql ?
Kevin Mark <kevin.mark@verizon.net> wrote:
I've had to do this several times now, it's a fairly painless procedure.
I've added a few notes...
> Hi Justin,
> probably the simplest way is to just make a new /var on the new drive
> and move all of it there.
> -add new HD to computer
> -partition HD
> -format HD
* For /var, I *strongly* suggest using the -j option when formatting, eg;
mke2fs -j -L var /dev/hdb
> -mount new HD as /mnt/newvar
> -stop all processes (like single user mode)
> -copy all of /var to /mnt/newvar
... Using cp -a and the slashdot will make sure things are copied over as
exact as possible;
cp -av /var/. /mnt/newvar/.
> -move /var to /oldvar (not sure this works)
It does. :-)
> -create /var
> -edit fstab to add mount point to make new partition point to /var
> -reboot and hope it works
Before reboot, I'd do a "mount -a", and then a "df", just to verify that
everything looks good.
Also, *especially* for systems hosting databases, you really want to turn
write cacheing off on the drive. It makes it run a teensy but slower, but it
is another line of defence against data loss if, say, the power goes out.
Between that and journalling you'll be doing a lot to protect your data
integrity.
To do this:
Install the "hdparm" package, then set up options like this in
/etc/default/hdparm :
harddisks="/dev/hdb"
hdparm_opts="-W0"
Cheers,
Tyler
Reply to: