0

I have a server hosting some 80 small rails applications. We have recently upgraded the disk space, so now we have to move all sites to this new disk. The host is a VMware ESX server, so all disks are virtual.

We have an virtual host and apache config file for each file. In this file we define a development, testing, acceptance and production environment, each on its own domain. The production environment can have multiple domains. The websites are currently in a directory on the '/' partition (bad idea, I know), and need to be moved to a fresh partition. The websites run a Sqlite database, so that has to be copied as well.

We want to move these websites to a different disk. Easiest thing to do is shut down apache, copy the files, and remount the disk at the old location. This would cause significant downtime, since its around 100GB of data that needs to be copied.

Is there a way to synchronize the new disk with the old files, and then swapping them 'instantly'? Or maybe automatically moving the websites one by one, to minimize downtime for each? My greatest fear is corrupting the Sqlite databases if they are written to while the operation is in progress.

1 Answer 1

1

Two solutions :

  • if your filesystem allows it you could make a snapshot and unpack it on the new disk. XFS allows this (and probably JFS, I don't know). You can grow the partition afterwards to your the size of the new disk if you want.

  • you could first copy everything disk to disk with a normal cp command and your old disk active. and the when your ready to switch you shutdown apache. rsync the old disk to the new disk like :

    rsync -Cavz --delete <OLDDISKPATH> <NEWDISKPATH>
    umount <OLDDISKPATH>
    mount --move <NEWDISKPATH> <OLDDISKPATH>
    

    and start apache and you're done with minimal downtime.

2
  • Thanks, I'm gonna try the second option. Shouldn't that last command read mount --move <NEWDISKPATH> <OLDDISKPATH>, or does mount figure that out by itself? Jul 27, 2010 at 13:22
  • you're completely right, it should include --move. I changed the answer.
    – Jasper
    Jul 27, 2010 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .