I took the disk drive out of my Lenovo T430 and replaced it with a 1Tb SSD. I'd like to migrate my Windows 7/Ubuntu installation from the 500Gb HDD to the SSD and use the HDD for storage.

Relevant details:

  1. I have a 1TB external drive that I'm currently using to run my Apache server (in Ubuntu). If there is a way to resize the partition to 500Gb, I could use it to backup my laptop's HDD while I transfer to the SSD.

  2. Here are the results of fdisk -l:

    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x0141a52b
    Device     Boot         Start         End      Blocks   Id  System
    /dev/sda1     *          2048     3074047     1536000    7  HPFS/NTFS/exFAT
    /dev/sda2             3074048   837507071   417216512    7  HPFS/NTFS/exFAT
    /dev/sda3           939907072   976771071    18432000    7  HPFS/NTFS/exFAT
    /dev/sda4           837509118   939907071    51198977    5  Extended
    Partition 4 does not start on physical sector boundary.
    /dev/sda5           837509120   932136959    47313920   83  Linux
    /dev/sda6           932139008   939907071     3884032   82  Linux swap / Solaris
    Disk /dev/sdb: 960.2 GB, 960197124096 bytes
    255 heads, 63 sectors/track, 116737 cylinders, total 1875385008 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000d16a4
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1              63   937502047   468750992+  83  Linux
    /dev/sdb2       937502048  1875385007   468941480    7  HPFS/NTFS/exFAT

    I already split the SSD into a 500gb partition for Windows and a 500GB partition for Ubuntu, but this is easy to change or redo if I need to.

  3. I also have a 32GB flash drive that I can maybe use as a recovery disk? All the other questions I've read on this topic had to use some kind of Windows recovery disk, but since my laptop came with Windows 7 preinstalled, I'm not sure where to get this.

  • Do you have a way to connect both the SSD and the HDD to the laptop (or another computer) at the same time? – alex_d Aug 2 '16 at 1:44
  • Yes, both the HDD and the SSD are installed in the laptop. If I can resize the Ubuntu partition on my external drive, I can also connect it over USB. – J. Ford Aug 2 '16 at 2:03

Since you have both disks connected at once, I'd recommend using dd to clone your old 500 GB HDD to the SSD. This will copy the partition table as well, so your new drive will appear to be 500 GB afterward. Once cloned, you can expand/modify the partitions as you desire to make full use of the new drive (would need more information to be more specific).

Although it shouldn't be required, it is of course good practice to make a backup before performing operations. In addition, the standard dd disclaimer applies: incorrect usage can and likely will destroy data.

In your case, the appropriate command would be

dd if=/dev/sda of=/dev/sdb

This copies data byte by byte from /dev/sda to /dev/sdb, cloning the entire drive, including bootloader and MBR or GPT partition table. Data on the output drive will be overwritten without warning or confirmation. Defaults for dd's other options should suffice, but see the man page for more.

I've personally done this a number of times to copy old hard drives to new; the step with the most potential for data loss is modifying the partitions once they've been copied to your new drive, but assuming you don't format your old drive immediately, you can just copy damaged data a second time. Also note that you can copy data between partitions with dd as well, using /dev/sda1, /dev/sdb1 (for example) as input and output files. This requires manually creating the partitions on the new drive to copy data to, using GParted or your favorite partition manager.

  • Great! Do you think Windows will be able to boot from the new drive? It seems like it should if it is a byte for byte copy, but I've seen indications online that it won't? – J. Ford Aug 2 '16 at 2:59
  • Also, do I use dd to copy one partition to another of equal size and then resize it? Or can I copy a small partition into a larger one? – J. Ford Aug 2 '16 at 3:03
  • It should boot just fine. I'd guess that the problems you've been seeing online were related to UEFI or secure boot difficulties, which shouldn't be a problem with a direct copy like this. And if you do a partition to partition copy, a small partition can be copied into a larger one (of course, the reverse isn't true). – alex_d Aug 2 '16 at 3:10
  • Note that the dd of 500GB from sda to sdb converts 1TB drive to 500GB since it is a byte for byte copy. All data in last 500GB will not be accessible. Partition table is converted to that of 500GB drive. – oldfred Aug 2 '16 at 4:00
  • @oldfred That's why I included the modification of the partitions step. Perhaps I should have been more specific - I'll edit to include. – alex_d Aug 2 '16 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.