Monday, October 21, 2019

Migrating DualBoot System to SSD (Of smaller size):

Recently, I’ve migrated my Dual Boot System (Ubuntu 16.04 + Windows10) from Hard Drive to SSD, for performance reasons. Now a days, SSD is not that expensive and I’ve purchased a 240G SSD for just 2.1K Indian rupees.

I’ve gone for disk cloning method using Clone-Zilla, since setting up a dual boot system from scratch will take days. The entire process completed in hours, and below are the major steps to follow.

Before getting into details below given the performance gain, I’ve acquired with the new SSD.

Lubuntu 16.04

On  HDD (Seconds)

On  SSD (Seconds)

System Boot

31

12

Opening Chrome

4

< 1

System Shutdown

5

4

 

Windows10

On  HDD (Seconds)

On  SSD (Seconds)

System Boot

50

19

Opening Chrome

4

1

System Shutdown

14

11

Over all the performance gain is between 50-60%. That’s impressive!


Here are the steps I’ve used for Migrating the dual boot system from HDD to SSD in no time.

1. Connect your Second SSD to any available SATA slot, and boot the system

 

2. Use CheckDisk on your Source HDD Partitions, to fix any disk errors.

 

3. Reboot to PartedMagic Live CD (which has CloneZilla and GParted applications)

 

4. Take your Source HDD Partition Layout, and export to a text file

Refer Step#5, in this article

5. Update the partition layout to suite your target SSD size

 

The text file you’ve got from Step#4, have the partition layout of your source HDD (in our case its much bigger – 1TB -  compared to SSD). We’ve to suite it to the target SSD, which is smaller in size (in our case its 240GB)

 

The trick is, Keep only those partitions, which represent the Dual Boot system, and remove all other partition entries to reduce the size. Say keep the boot sector, the first boot partition for windows, the windows partition, the application partition for windows (D: drive, if you’ve) and the Linux (Lubuntu) partition. The rest of the partition entries have been deleted.

 

To have a depiction, below given my Source HDD, and Target SDD structure after performing the above steps: The red rectangles shows the partitions removed, while copying the structure to the target SSD

 

Source HDD:

 

Target SSD:

 

The green rectangle shows the retained partitions (of exactly the same size as that of the source HDD) and red rectangles, which are of deleted partitions.

 

Note: To remove the unwanted partitions, simply take out those lines from the exported text file. Or you could update the cylinder size to match the smaller SSD, for the unwanted partitions. In our case, we’ve reduced the size of (sda7, sda8, sda4 and adjusted the size of sda3 by calculating the reduced size of sda5, 6, 7 and 8). See example from our environment

 

6. Restore the updated partition Layout to your target SSD

 

Refer Step#5 from this article on the command line to be used:


7. Clone the required partitions, from Source HDD to target SSD.

 

In our case its about cloning only sda1, 2, 5, 6 to sdc1, 2, 5, 6 respectively. We don’t have to clone the MBR, because it will be separately taken care in another step.

 

While cloning, use Clone-Zilla in “Device to Device” mode to directly migrate each required partition, from HDD to SSD, rather than “Device with Images” mode. Below figures shows the required mode from Clone-Zilla. Repeat this for each partition which needs to be cloned

 

You may refer the steps from this blog, though it is speaking about using “Device - Image” mode. Have the aforementioned tweaks for “Device – Device” mode, for this scenario.


8. Recreate UUID’s for the cloned partitions in the Target SSD

Note: Perform this step, if you would like to use the Source HDD along with the new SSD, as a backup device. This step is not required, if you would like to remove the Source HDD once SSD configuration is done

 

Its required to recreate the UUIDs for the target SSD partitions, to avoid conflicts. Use GParted (Below fig) for recreating the same. For ext4 and similar partitions, use “tune2fs” command to recreate the UUID

 

 

9. Update the “/etc/fstab” entries to have the new UUIDs

 

Don’t forget to update any existing “fstab” entries on the Target SSD, Linux File System (In our case its /dev/sdc5), to have the new UUID’s for mount points

 

10. Reboot to Lubuntu 16.04 Live CD, and install Grub2 on MBR

 

Perform the Step#3  from this blog:

This makes the new SSD system bootable

 

11. In BIOS enable, the SSD as the first bootable media


12. In BIOS disable, the Source HDD SATA PORT

 

13. Reboot to SSD, and boot to Lubuntu 16.04

 

14. Re-install grub2 (using sudo update-grub2)

 

15. Insert Windows10 Installation DVD, and reboot

 

16. Boot to Windows10 DVD, and go for Troubleshoort->Startup Repair Option

To change it to the new SSD Device ID, this step is required

 

17. Remove the Windows10 DVD

18: Optional (Fixing, Flickering Windows Desktop On Boot).

Keeping both HDD and SDD in the same Machine

This step is required if you would like to keep both SDD and HDD (as a backup device)  in the same system. This step also could be tried out if Step#16 does not make the system bootable.

Remember that the cloned SDD now references the partitions in your old HDD, which needs to be changed. There are two places which are to be updated.

a. First place is the BCD in SSD Boot Partition, which needs to be opened in the registry edit, and update all old HDD Partition reference to new SDD reference. This is the Boot Partition and the C: System Partition. Lookup your new SSD Partition UUID’s by using ‘blkid’ in your linux system.

Refer this link, on how to update the BCD. If you’re having permissin issues, right clik on the Hive and update persmissions.

image

 

b. The second place is the registry location (HKLM\SYSTEM\MOUNTED DEVICES) in the SSD designated C: Drive ( System Partition). Open (C:\Windows\System32\config\SYSTEM) registry hive in regedit, and update so that C:, D: drive now maps to the corresponding SSD cloned partitions. Simply rename the entries to remap the drives.

Refer this link on how to edit the hive. Open the SYSTEM registry hive from SDD System Partition.

Under MountedDevices key, Rename old HDD C: and D:, to temporary drive letters and make the right SDD Partitions as C: and D:. Finally assign the old HDD C: and D: partitions to the same drive letter which the corresponding SDD partitions were using.

 

Finally you could backup BCD and registry SYSTEM hives for both HDD, SDD in a safer place for later references or restorations.

 

PS: The flickering happens because each SYSTEM Drives (C: ) both in HDD, SDD points to each other and on startup they try to load each other, in a never ending loop. This steps elimates such issues

image

 

 

19. Reboot to your SSD, Windows10 installations (By selecting the option from the Grub menu)


 

20. If everything works, re-enable the Source HDD SATA Port in Bios

If your old Source HDD is not mounted during Windows boot – due to signature conflicts-, open disk management, right click on the source HDD and opt “Online”


 

Additonal Topic - Extending SSD’s Life Span:


Its important to note that, SSD’s life span directly depends on the number of writes made to the drive. So if we reduce the number of writes, we could extend the life span. Below are the few things we’ve done to save the writes to the SSD


1. Have enough free-space on SSD:

So that SSD controller will evenly distribute the writes, hence every cells will be evenly used for extended life span.

2. For Lubuntu, we’ve enabled the swap in the Source HDD (rather than in SSD)

 This entry was made in /etc/fstab, to point to the swap area in HDD


3. ForLubuntu, Move/Use the Home folder under Source HDD, rather than in SSD, as most of the disk writes happens under your profiles (Say chrome writes temporary data inside your home directory)


This could be easily accomplished by an entry in fstab, like:

/dev/sda10 /HDD ext4 nodev,nosuid 0 2
/HDD/home  /home none bind 0 0

 

4. Enable “Write Cache” mode on SSD

 

5. For Windows, we’ve pointed the TMP, page file to Source HDD Location (rather than in SSD)

No comments:

Post a Comment