[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Best way to migrate disks



On 03/25/2012 01:16 AM, Marc Shapiro wrote:
I have an old 40GB disk and a recently purchased 1TB disk. The new disk has been partitioned into a 2GB swap partition, two 500MB partitions that are currently empty and the remainder is an LVM2 PV which I have added to my VG, so I now have plenty of space. So far, so good.

My problem is that I am still booting off of the 40GB disk and my / partition has pretty much run out of space (it is about 280MB). I want to migrate everything from there into one of the 500MB partitions on the new drive and boot from there. What is the best way to do this? Any suggestions?

Marc



First, make a backup. Don't modify anything on the old disk, just in the new one!!!

What are the 500 MB partitions for? Well It does not matters, but I will use them in this example. I always do this on my laptops.

Make identical (size) volumes on LVM in the new disk as many partitions you have on the old disk.

Now reboot with debian live cd or usb stick and bring up LVM or... do all of this without reboot directly from your current system running but stop as many services as you can.

Then supossing your old disk is:

old disk: sda1=/boot (1GB), sda2=swap (9GB), sda3=/ (30GB)

You must configure your new disk similar to this:

new disk: sdb1=/boot (500M), sdb2=none (500M), sdb3=lvm=>rest(999GB). In lvm at vg00 you must create: lvswap (9GB), lvroot (30GB).

Then use the command "dd" to copy each partition... one by one... byte by byte:

dd if=/dev/sda3 of=/dev/vg00/lvroot

The same with /dev/sda1 and all the none swap partions of your old disk.

Later copy the boot sector with GRUB: dd if=/dev/sda of=/dev/sdb bs=512 count=1

You must mount and edit the /boot/grub/menu.lst and /boot/grub/device.maps in the NEW DISK to fit the new hardware names... adjust "sda" to "sdb".

Disconnect the old disk and boot from new one installed as master on your mother board.

Done!

If anything fails you always can start all over again your old disk is save.

--
---------------------------------------------------------------------
   "You don't know where your shadow will fall",
        Somebody.-
---------------------------------------------------------------------
 Ing. Olaf Reitmaier Veracierta<olafrv@gmail.com>
---------------------------------------------------------------------
 Personal Web Page -- http://olafrv.com -- info@olafrv.com
---------------------------------------------------------------------


Reply to: