Ubuntu – Clone a hard disk and then re-partition it

cloninghard drivepartitioning

I would solve this problem: I want to move all my data in my actual hard disk of 500gb, because it is almost full, to a new hard disk of 1TB with the possibility to enlarge the partitions.

If I clone my disk, then can I enlarge those partitions? Which tools do you suggest?

EDIT

This is the output of sudo parted -ls

Model: ATA ST2000DM006-2DM1 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2000GB  2000GB  primary  ntfs         boot
 2      2000GB  2000GB  482MB   primary  ntfs         diag


Model: ATA STM3500418AS (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type      File system  Flags
 1      1049kB  256MB  255MB  primary   ext2         boot
 2      257MB   500GB  500GB  extended
 5      257MB   500GB  500GB  logical


Model: ATA ST1000DM005 HD10 (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1000GB  1000GB  primary  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/al91--vg-home: 456GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0,00B  456GB  456GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/al91--vg-root: 30,0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0,00B  30,0GB  30,0GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/al91--vg-swap_1: 14,3GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system     Flags
 1      0,00B  14,3GB  14,3GB  linux-swap(v1)


Error: /dev/mapper/sda5_crypt: unrecognised disk label
Model: Linux device-mapper (crypt) (dm)
Disk /dev/mapper/sda5_crypt: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

I have 3 hardisks: one with Windows, one with Linux and one for backups. Don't consider the Windows and backup disks, please.

Thanks in advance.

Best Answer

There is a system partition, so I suggest cloning as described also in the answer by @vidarlo, and I like Clonezilla, clonezilla.org.

  • Clone the whole drive.

Warning: Do not boot from the installed system, when both the original drive and the cloned drive are connected. It can damage one or both systems.

I suggest that you boot from an Ubuntu live drive (DVD disk or USB pendrive) and use gparted to edit the partitions on the new drive (after the cloning), GrowIt.pdf.

  • Keep the position of the head end of the system partition.

    • It is easy if it is the first of the two main partitions; in this case it might be simpler and it is definitely faster to remove the data partition, expand the system partition as much as you want. To move the data partition will probably be very slow.

    • Then make a new data partition (and probably also a linux-swap partition) in the remaining unallocated space.

    • Finally copy the data files from the original drive to the data partition in the new drive.

  • Otherwise, if the data partition is the first of the two main partitions, please let us know the partition structure as shown by the following command

    sudo parted -ls
    

Edit: You have edited the question to include the output rendered as code (indent each line 4 spaces), and I have picked what I think are the relevant parts of it,

Model: ATA STM3500418AS (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type      File system  Flags
 1      1049kB  256MB  255MB  primary   ext2         boot
 2      257MB   500GB  500GB  extended
 5      257MB   500GB  500GB  logical
...
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/al91--vg-home: 456GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0,00B  456GB  456GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/al91--vg-root: 30,0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0,00B  30,0GB  30,0GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/al91--vg-swap_1: 14,3GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system     Flags
 1      0,00B  14,3GB  14,3GB  linux-swap(v1)


Error: /dev/mapper/sda5_crypt: unrecognised disk label
Model: Linux device-mapper (crypt) (dm)
Disk /dev/mapper/sda5_crypt: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

You have a system with LVM. It is more advanced than the standard system used in Ubuntu. It should be more flexible to manage (than the standard system), when you know how to do it, but I have almost no experience of LVM systems. So I cannot help you beyond this point.

I hope that someone who knows will chip in an help you with relevant instructions. If there is no useful answer here within the next day or two, I suggest that you ask a new question about resizing an LVM system. It helps if you supply the output of the command

sudo parted -ls

and describe the details.

I think it is even better to search the internet for tips and tutorials, for example with the following search string: 'resize LVM' (without quotes).

I found this link to another question at AskUbuntu,

How can I resize an LVM partition? (i.e: physical volume)