[mythtv-users] Adding a new hard disk

Rich West Rich.West at wesmo.com
Thu Apr 26 16:33:57 UTC 2007


Ben Lancaster wrote:
> Hey,
>
> Having read about the performance benefit of using a separate hard  
> disk for the OS/MySQL, I'm going to slot in a new drive. At the  
> moment I have one 400GB drive divided into the following partitions:
>
> Filesystem		Size	Used	Avail	Use%	Mounted on
> /dev/sda2		24G		8.0G	15G		36%	/				ext3
> /dev/sda6		269G	182G	88G		68%	/Media			xfs
> /dev/sda1		99M	14M	80M	15%	/boot			ext3
> /dev/sda5		77G		59G		15G		81%	/home			ext3
>
> No LVM and no RAID.
>
> So, what I'd like to do is migrate the OS, /boot, /home and swap over  
> to a new disk, but I'm at a bit of a loss how to get it booting from  
> the new disk? Is it as simple as recreating the partitions on the new  
> disk, plugging that into the first SATA channel and the 'old' disk in  
> the secondary, and re-referencing the partitions in fstab?

It does depend somewhat on the distribution as to what the process is.

I went through this on my backed just last weekend.  I wanted to
eliminate the remaining "trying out mythtv" aspect of my setup, which
consisted of having the OS and video stuff on the same drive.  I was
running Fedora Core 5, but I was using LVM, which did make things a
little more complicated.  I'll leave off the steps surrounding the
renaming of the existing LVM since you aren't using LVM.

The process I went through was:
1. I mounted a network drive at /mnt/backup, but so long as it is a
different partition from the one you are backing up, you should be fine.
2. I used "dump 0f /mnt/backup/root.dump /" to create a dump file of the
root filesystem.
3. I used "dump 0f /mnt/backup/boot.dump /boot" to create a dump of the
root filesystem.
4. In another system, I installed the new (empty) root drive.
5. Because I am using LVM, I did a quick (15 min) install of a very
basic FC5 installation.
6. I booted off of the Fedora Core DVD via "linux rescue"
7. In rescue mode, I had it detect the local install.
8. I then mounted the same network drive on /tmp/backup when in rescue mode.
9. The dummy-install of FC5 was auto-mounted at /mnt/sysimage, so I did
"cd /mnt/sysimage/boot", and removed everything in there.
10. I then ran "cd /mnt/sysimage/boot; restore xvf /tmp/backup/boot.dump".
11. I then went to "cd /mnt/sysimage" and moved nearly everything in to
a directory called "old" (bin home lib64 media mnt opt root usr etc lib
misc net sbin tmp var).
12. I then ran "cd /mnt/sysimage; restore xvf /tmp/backup/root.dump"
13. When everything was complete, I un-mounted the network mount and
rebooted.
14. Again, I booted off of the DVD via "linux rescue", and I let it
attempt to detect the installation on the new drive (it will).
15. Once in rescue mode, I ran "chroot /mnt/sysimage" followed by
"grub-install /dev/hda" (in your case, it would be "grub-install /dev/sda")
16. I exited out of the chroot, then rebooted the machine and it happily
came up. :)

The reboot before the chroot was necessary.  grub-install wouldn't work
if I didn't have "linux rescue" re-detect the installed OS.

Now, the above was done in an LVM environment.  I would guess that if
you are not using LVM, the steps would be a little easier.  For one, I
don't think you would have to do the basic FC5 install (step #5), and
you could format, partition, and mount the new drive at step #7.  The
rest should be the same (including the reboot at step 14. :)

I hope this helps..  Oh, and don't forget to make a swap partition on
your new root drive. :)

-Rich


More information about the mythtv-users mailing list