Web Dev Blog

Looking for help with WordPress, Apache, Vim, Web Security and more. Here are a few tips.

Replacing Hard Drive under LVM in Ubuntu

Recently had a hard drive start acting strangely on my development server. It is a 2TB Seagate drive and it started causing errors in the logs, nothing major and it still worked. I put off ordering a new drive, a mistake, I know, but thought maybe it was just some kind of software issue.

Then the machine started getting slow. Really slow. So I ordered a new 3TB Toshiba drive. Finally received it and thought I would use Clonezilla to copy the drive. Created a live USB Linux flash drive with the Clonezilla image. Worked like a champ, but the cloning was going very slowly due to the problem with the drive, so I bailed. After some additional tinkering, and fixing grub because Clonezilla had modified it, I was able to boot back up and I realized that I was using LVM and this creates another problem.

I’m not sure if cloning and replacing the drive would have worked or not, but found some guides on replacing a drive in LVM.

Here is the one I used

Basically you add the new drive to the LVM and then use pmove to migrate the content off the old drive. Honestly, I’m not sure yet how this is going to work, it’s been almost a day and a half and I’m at 45.8%. If it fails I have a backup, but it would be nice if this process works and everything moves.

Leave a Reply