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
  • 1
  • 1
    yes you've come right to the crux of the source problem - next time I do this I'll only clone the boot sectors of the partitions, and then copy via rsync or cpio or something the files. Original reason for dd'ing was there are too many hacked together installs of essential software to re-install. It would have taken weeks, but now I'm almost at a week fixing my clone! – a different ben Jan 19 '12 at 1:50

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.
  • As I tried to explain in the question, I created the partitions first, then dd'd individual partitions, so the partition table is new, not cloned from the old drive. I was toying with the idea of using parted to nudge the partitions a bit, hoping that in so doing it would fix the whole lot up. Any thoughts? – a different ben Jan 20 '12 at 0:27
  • I did that just - booted with a live cd, used gparted to fiddle around the edges, now seems like everything is back together. Can I answer my own question? – a different ben Jan 25 '12 at 1:33
  • @adifferentben: Yes you can – jkj Jan 26 '12 at 12:20

I successfully took what you might call the sledgehammer approach: booting with a Live CD I used GParted to fiddle with the partitions a bit (i fiddled with all of them just to be certain, not sure what happens to the others if you just fiddled with one), upon reboot into my system all was well again. df, parted, fdisk, etc all reported same sizes and correct free space.

If you take this course of action, make sure you get backups of whatever's important to you.

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.