Padd Solutions

Converted by Falcon Hive

My server used to have a 16GB hard drive, and did not receive regular automated backups. I wanted to upgrade the drive to an 80GB one and use the old drive for automatic backups. This switch required that I somehow move the entire server installation from the old to the new, larger drive. So I decided to use a tool called Clonezilla. I cloned the old drive onto the new drive, and set the new drive to the master. Booting up with the new drive worked fine. I put in the old drive (which still had the server installation) as a slave for backups. It was then that I ran into an interesting problem: no matter what I did, the old drive would always boot instead of the new one. After some probing, I found out that GRUB was run on the new drive, but it always pointed to the old drive. After about 6 hours of banging my head against the wall, I finally figured out that the UUIDs for the two drives were the same since they were cloned. Instead of using the generic (hd0,0), the Ubuntu distribution uses UUIDs by default to point to the drive that should be booted from. The UUIDs were not so universally unique anymore, and GRUB got confused and booted the old drive. So I guess the moral of the story is always make sure you change the UUIDs whenever a cloned drive is used. Anyways, sorry if this notice came too late. I hadn't expected to run into such trouble.

For reference, here's the steps to change a duplicate UUID:
  1. Run uuidgen to generate a new UUID.
  2. Type in tune2fs /dev/hdaX -U [newuuid] to actually update the partition's UUID. Be sure to replace hdaX with the correct partition and [newuuid] with the UUID given by uuidgen.
  3. Verify that the UUID was changed properly with vol_id /dev/hdaX.
All bundled up, the command is uuidgen | xargs tune2fs /dev/hdaX -U ; vol_id /dev/hdaX. If you just need to clear out the old drive with the duplicate ID, reformatting it would do the trick, too.

If some of you are wondering, this is the source of the recent downtime my server went through. The sites that were affected included this one, and my NXT++ and Linux4nano wikis. The sites were on and off for about a period of 24 hours. I hope this short tutorial helps some people solve the problems I experienced.

(0) Comments

Post a Comment