Partition size inconsistency after dd clone


We have recently upgraded a system HDD – it was 160GB, now 2TB. We upgraded as we were running low on space, mainly on /usr, and also on /home.

I prepared the new drive with a Live CD and GParted (and made some partitions larger). Then I cloned /, /usr, and /boot to the new drive using dd. The partition size of /usr on the old drive was 23GB, but I made it ~50GB on the new larger drive. However it seems there is now an inconsistency between what parted sees, and what fdisk etc see. All of the partition sizes are inconsistent, but /usr is way off, and /boot is as well. Is /? I can't quite tell. sda7 is 14G to df, but 15.2GB to parted.

Here's df -h:

harb@joan:~$ df -h
Filesystem            Size Used Avail Use% Mounted on
/dev/sda7              14G  2.0G   12G  16% /
none                   12G  308K   12G   1% /dev
none                   12G  400K   12G   1% /dev/shm
none                   12G  456K   12G   1% /var/run
none                   12G     0   12G   0% /var/lock
none                   12G     0   12G   0% /lib/init/rw
/dev/sda6             5.8G  140M  5.4G   3% /tmp
/dev/sda1             230M   55M  164M  25% /boot
/dev/sda9              37G  176M   35G   1% /scratch
/dev/sda10            1.7T  185G  1.4T  12% /home
/dev/sda5              23G   21G  992M  96% /usr

Here's a snapshot of the partitions from parted:

harb@joan:~$ sudo parted /dev/sda print
[sudo] password for harb: 
Model: ATA WDC WD20EARS-00M (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  263MB   263MB   primary   ext4            boot
 2      263MB   2000GB  2000GB  extended
 5      263MB   52.7GB  52.4GB  logical   ext4
 6      52.7GB  59.0GB  6292MB  logical   ext4
 7      59.0GB  74.2GB  15.2GB  logical   ext4
 8      74.2GB  148GB   73.4GB  logical   linux-swap(v1)
 9      148GB   190GB   41.9GB  logical   ext4
10      190GB   2000GB  1811GB  logical   ext4

Here's fdisk:

harb@joan:~$ sudo fdisk -l /dev/sda

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001db18

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      257008+  83  Linux
/dev/sda2              33      243201  1953254992+   5  Extended
/dev/sda5              33        6406    51199123+  83  Linux
/dev/sda6            6407        7171     6144831   83  Linux
/dev/sda7            7172        9019    14844028+  83  Linux
/dev/sda8            9020       17943    71681998+  82  Linux swap / Solaris
/dev/sda9           17944       23042    40957686   83  Linux
/dev/sda10          23043      243201  1768427136   83  Linux

Best Answer

If you dd'd the whole thing with the partition table:

  • Change the last partition to use rest of the disk. (You may need to delete and create the partition in fdisk on exactly the same start offset as before.)
  • Expand the filesystem with resize2fs.
Related Topic