1. Shut down the system, remove the old drive, and install the new drive. Do not leave the old drive in the system, since you do not want to accidentally reformat the wrong drive.
2. Install Ubuntu on the system (see Chapter 1). Be sure to use the same base install. Don’t bother customizing this new install—it is only needed for making the drive bootable.
3. Shut down the system and install the old hard drive as the second drive.
Do not boot from the old hard drive.
4. Start up the computer and boot from the new drive.
5. Log in when the computer has rebooted and open a terminal.
6. Nowfor the hard part—finding thedrive’sdevice handle for the olddrive. This is a two-step process. First, use mount to identify the current drive. It will be the one that is mounted. Second, use sudo lshw -class disk to find the unused drive that needs to be mounted. In this example, the current drive is /dev/sdb and the new drive is /dev/sdc.
$ mount | grep -e /dev/sd -e /dev/hd
/dev/sdb1 on / type ext3 (rw,relatime,errors=remount-ro)
$ sudo lshw -class disk
*-disk:0
description: ATA Disk
product: ST3500320AS
vendor: Seagate
physical id: 0
bus info: scsi@4:0.0.0
logical name: /dev/sdb
version: SD15
serial: 9QM52R9R
size: 465GiB (500GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 signature=00070904
*-disk:1
description: ATA Disk
product: ST31500341AS
vendor: Seagate
physical id: 1
bus info: scsi@5:0.0.0
logical name: /dev/sdc
version: CC1H
serial: 9VS2N2QN
size: 1397GiB (1500GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 signature=00052eee
7. Mount the old drive partition(s). The partitions will be enumerated. Since drive /dev/sdc is aworking drive, there should be /dev/sdc1, /dev/sdc2, etc. If you know the data partition, then you can mount it. Otherwise, you can blindly mount each of the partitions.
cd /dev
for i in sdc[0-9]* ; do
sudo mkdir /media/$i
sudo mount /dev/$i /media/$i
done
8. As root, copy over all of the old files to the new system. For example, if /dev/sdc1 was the old / partition, then copy the data from /media/sdc1/ to the new /.
$ cd /media/sdc1
$ ls
bin dev initrd lib mnt root sys var
boot etc initrd.img lost+found opt sbin tmp vmlinuz
cdrom home initrd.img.old media proc srv usr vmlinuz.old
$ sudo tar -cf - * | ( cd / ; tar -xvf - )
9. Repeat Step 8 with each of the data partitions. Be sure to copy data to the correct directory. For example, if /dev/sdc2 was /home, then copy the contents to /home, not /.
10. Since the copy may have brought over a newer kernel, you will want to reset the boot loader:
sudo update-grub
11. Now that everything is copied, you can reboot the system immediately. You don’t want to use shutdown, since that can save desktop settings over your new settings. To force an immediate reboot, use the -f parameter:
sudo reboot -f
When the system comes back up, you should have all of your old files right where you left them, and a minimal amount of residue (undesirable files) that you did not originally want. This method is great for switching partition layouts, since it only copies files, but it should not be used to upgrade operating systems.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
No comments:
Post a Comment