email domain management home : internet : mail : toaster : FAQ : hard drive upgrade old message expiration

How do I upgrade my hard drive?

I have used this procedure on many, many production systems without incident. These instructions are what works for me. YMMV. Use at your own risk. There is a strong possibility that you will hose your system during this upgrade so try it on a test server! If you don't have a test server, hire someone that's done it before. Preferably someone whose done it many times before! Like me, who has screwed up this process on my own systems in every conceivable way, thus learning how to avoid messing up yours.

  • 1. Insert the new hot-swap SCSI disk in your server
  • 2. Use camcontrol rescan to tell FreeBSD to detect it.
  • 3. Use sysinstall to configure and partition it.

I mount the new partitions on /mnt: /mnt/root, /mnt/usr, etc. Once the new partitions are mounted, I use pax (pax -rwpeX) to copy all the files from the old to the new partition (while the server is still online).

  • cd /
  • pax -rwpeX . /mnt/root/
  • cd /usr
  • pax -rwpeX . /mnt/usr/
  • cd /var
  • pax -rwpeX . /mnt/var/

Once that's done, I have a 10 minute old copy of the active (old) drive on the new one. A few files won't copy properly (they'll be in use), etc but I'll have 99% of the file system copied with negligible system impact and no down time. Now it's time to drop to single user mode and use rsync to sync up the disks.

  • shutdown now
  • rsync -avxW --delete / /mnt/root
  • rsync -avxW --delete /usr /mnt/usr
  • rsync -avxW --delete /var /mnt/var
  • shutdown -h now

You're ready to boot off the new disk. Turn off the power, remove the old SCSI disk, insert the new one in it's hot-swap bay (so it get's the same SCSI device ID), and turn your server back on. Voila, you just upgraded your disk with only 2 minutes of down time.

Last modified on 4/5/05.