Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a working dual-boot setup (Ubuntu 12.10 and Win7) on my laptop.
I got a 320GB HDD with partitions for /, /home, swap, winsys and a big windata partition. There's more than 250GB space occupied overall.

Now I bought a 250GB SSD which I will put in my Ultrabay, and I want to migrate all the partitions except the big data partition onto the SSD, enlarge them in a controlled manner according to SSD space, leave windata on the HDD, and expand it to the whole size. I want to avoid a fresh installation of both Ubuntu and Windows.

I read quite much already, but I'm unsure what the best way to accomplish this is?

  • Clonezilla disk-to-disk clone is out, because the target disk is smaller.
  • Clonezilla partitions-to-partitions (omitting the data partition) seems to be a way, but I can only enlarge the partitions proportionally (even if I can), and I don't know if this will create proper SSD partition alignment. Also, what about the boot sector/boot loader, especially w.r.t. dualboot?
  • The sanest way seems to be to use GParted from a live cd, create the partitions on the SSD as desired, then copy the HDD partitions into the new ones, and expand the data partition on the HDD. This seems to me the most uncomplicated way - GParted can do proper alignment, but I don't know if the boot loader can be copied, too? Also, if this works, why does everybody seem to recommend Clonezilla?
  • my boot partition is the first partition (sda1), where the windows system resides on.

Will doing this purely in GParted work? Can I safely drop the extended partitions setup (which I don't need anymore because now I only got 4 partitions per disk)? Or should I keep that around anyway if I want to further subdivide in the future (for a scratch disk etc)

Bonus question: my /home is still ext2 - can I make the new /home ext4, and copy the ext2 partition over, and it won't break?

I'm aware that I'll have to rewrite the /etc/fstab to adjust the UUIDs, and that I'll probably need a Windows rescue disk to "repair" the confused windows boot system. Any further pitfalls?

fdisk -l output:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0x80d2f3ee

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   104856254    52428096    7  HPFS/NTFS/exFAT
/dev/sda2       184538655   625137344   220299345    7  HPFS/NTFS/exFAT
/dev/sda3       104856255   136311524    15727635   83  Linux
/dev/sda4       136311649   184538654    24113503    5  Extended
/dev/sda5       148890420   184538654    17824117+  83  Linux
/dev/sda6       136311651   148874354     6281352   82  Linux swap / Solaris

Partition table entries are not in disk order
share|improve this question
    
I know that moving the /boot partition with GParted won't be that much of a problem as long as the new partition has the 'boot' flag set and you run link as well. I am not sure about moving windows though. –  DaboRoss Apr 25 '13 at 17:05
    
And I think you could copy data from your /home partition to a new one that is ext4 with a tool like rsync. I think you would have to copy the data though, because I don't think you can change a partition type. Like make a new /home partition and use rsync to copy all the data to it. Also with moving the /boot partition I believe that GParted has the ability to copy/paste partitions, and that is probably what you want to do. And you would have to edit fstab accordingly. You don't want to drop extended partition management, you will still want to have it on the new disk. –  DaboRoss Apr 25 '13 at 17:09
add comment

1 Answer 1

up vote 2 down vote accepted

I would use GParted to copy the / and winsys partitions.

Grub/linux will boot after the copy as long as you run Boot Repair. And according to this article, windows should be able to be moved with GParted as long as you have a windows repair disk to repair the installation after moving it.

Although you can safely drop the extended partition on the new drive as long as you only have 4 primary partitions, I wouldn't recommend it. Probably you will want to make the ssd into one extended partition and put all of the other partitions inside that one extended one.

Of course doing operations like this can always fail, even if the cause is something arbitrary like the power going out of the live cd failing, so defiantly take a backup of your data before copying it. And I would also recommend that you don't make any changes to the HHD until you have successfully booted into the SSD with both windows and linux.

Probably the steps you would want to take are:

Boot into live CD and run GParted.

Make an extended partition on the SSD covering the whole drive.

Copy linux / partition and winsys partition to SSD, leaving the original still unchanged on the HHD.

If you wanted /home on the SSD, then make a new ext4 partition inside the extended partition, and use rsync to copy all data from the original to the copy. An example rsync command could be like this:

sudo rsync -rhtvlpEog --progress /media/PATH_TO_HOME_PARTITION_ON_HHD/ /media/PATH_TO_HOME_PARTITION_ON_SSD/

explaination of that command: -r copies recursivly, -h gives human readable output, -t preserves modification times, -v gives more output, -l copies symlinks as symlinks, -p keeps file permissions, -E keeps executablility, -o keeps owner, and -g keeps group.

Mark winsys and / as bootable on the SSD.

Unmount and possibly disconnect your HHD from the computer, then run boot-repair, install grub to the SSD and making the / bootable.

still from the live CD, edit the fstab on the SSD / partition to have the new /home partition UUID.

Test that grub/linux works by booting your computer with only SSD mounted. (Also test that you have all the data in your /home partition)

Then if it does, use a windows repair disk to get the windows partition on the SSD bootable.

After using windows repair disk on the SSD, try booting into both windows and linux, without connecting the HHD.

Note: Be sure to not delete or move anything on the HHD, until you have confirmed that both windows and linux work on the SSD.

If all works on the SSD, then erase the /, /home, and winsys partitions from the HHD, and expand the windata partition to use the whole thing.

I have outlined the steps that I would take. I can't vouch for the windows repair disk working, but according to that article it should. I can vouch for Boot Repair working when moving the / partition though. I know that that works because I have moved my partitions around quite a lot using GParted.

Also if any of these steps fail and the SSD isn't bootable, you still have all of your data and everything still working on the HHD.

Additional experiences from the OP:

  • It's good to have 3 live CDs/USB sticks - GParted Live, boot-repair, windows system repair, I needed all three of them
  • I ended up not converting the home partition, so I didn't use the rsync step
  • Be aware that on partition copying, the UUIDs (unique partition identifiers) stay the same. This is great because you don't have to edit the Ubuntu fstab, and Windows won't want to be activated again, but after the initial copying stage, for testing you should remove/unplug the HDD from the system, otherwise there exist multiple partitions with the same UUID. This would have unexpected results.
  • Useful tools for making bootable USB sticks (if you don't have a CD drive anymore) from live CD images are tuxboot, unetbootin, TotalMounter. Especially for the Windows system repair disk, this can be tricky - use TotalMounter to create it directly into an .iso, and e.g. this guide.
share|improve this answer
    
Thank you, this worked. I'll edit some experiences into your answer. –  Christoph Apr 28 '13 at 13:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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