1

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.

DarkSkull
  • 111
  • Is is a system disk (with Ubuntu) or is it a data disk with 'only' data (documents, pictures, music, video clips etc)? I would recommend different methods for different cases. – sudodus Aug 23 '17 at 18:35
  • There are two partitions one contains the system the other the data. I want keep intact all two. – DarkSkull Aug 23 '17 at 18:47
  • You can clone the disk using the dd command in a terminal. After it has been cloned, you can resize the new copy using GParted. – SunnyDaze Aug 23 '17 at 21:58

2 Answers2

1

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)

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • @DarkSkull, please see my edited answer. You may find tips and tutorails searching the internet, for example with the following search string 'resize LVM' (without quotes). I found this link to another question at AskUbuntu, https://askubuntu.com/questions/196125/how-can-i-resize-an-lvm-partition-i-e-physical-volume – sudodus Aug 25 '17 at 06:20
  • Do you think is possible to remove lvm protection and then clone the whole disk? – DarkSkull Aug 25 '17 at 08:52
  • No. In that case you should copy the the whole content with for example the command line sudo rsync -Havn /path-to-source/ /path-to-target (test with dry run, and if it looks good remove n from the list of options and use the command line sudo rsync -Hav /path-to-source/ /path-to-target to do the real copying -- But you must also install a bootloader and fix the UUIDs in the files /etc/fstab and /boot/grub/grub.cfg to match those of the target drive. This is possible but not straightforward. – sudodus Aug 25 '17 at 12:45
  • I have not resized an LVM unit, so I have no own experience, but you dare try according to the instructions of the link in my previous comment. As long as you have disconnected your original drive, the worst thing that could happen is waste of time ;-) – sudodus Aug 25 '17 at 12:48
0

Enlarging partitions is straight forward. Copy the excising partition to the new disk, using ghost, dd, clonezilla or whatever tool you prefer. Then you can use gparted to extend the partition - or alternatively - if you're machoistic - delete the partition, create a new one at the same start, with a new end, and extend ("grow") the file system.

vidarlo
  • 22,691