Ubuntu – Ubuntu hdd not correct size


I am running ubuntu 12.04 64bit. I used the dd command to clone my 80gb drive (filesystem) to a clean 500gb. It worked flawlessly. Afterwards , I took out the 80gb and replaced it with the new 500gb. It boots up perfectly and the entire filesystem is as it was. However , when I right click inside a directory and click properties or when I tupe df -h , it shows that there is only 10gb free space. Howrver , in the disk utility it shows the 500gb as the filesystem and nothing seems wrong. How can I make ubuntu see that there is more than just 10gb free space on the new hdd ?


Here is the result I get in gparted and then also the contradictory result when right clicking in a directoryenter image description here and selecting properties:

Best Answer

If you copied one drive to another using dd, the partition table is copied from one drive to another as-is, so all your partitions are of exactly the same size as they were on the old drive. The rest of your new drive is unallocated space.

You need to boot from Ubuntu LiveCD/USB and use gparted to resize the partition(s).

Here's an example how unallocated space looks in gparted:

enter image description here

The above is true if you dd'ed the whole device to another, something like dd if=/dev/sda of=/dev/sdb. In case you created partitions on the target drive first and then copied a partition from one drive to another (something like dd if=/dev/sda1 of=/dev/sdb1), then the partition table on the target drive is correct (i.e. it has one partition which is ~500Gb), however, the filesystem on that partition is of the same size it was on the source drive.

To resize an ext4 partition you need to use resize2fs command.

   resize2fs [ -fFpPM ] [ -d debug-flags ] [ -S RAID-stride ] device [ size ]

   The resize2fs program will resize ext2, ext3, or ext4 file systems.  It can be used to enlarge or shrink an
   unmounted file system located on device.  If the filesystem is mounted, it can be used to expand  the  size
   of  the  mounted filesystem, assuming the kernel supports on-line resizing.  (As of this writing, the Linux
   2.6 kernel supports on-line resize for filesystems mounted using ext3 and ext4.).

   The size parameter specifies the requested new size of the filesystem.  If  no  units  are  specified,  the
   units  of  the  size  parameter  shall be the filesystem blocksize of the filesystem.  Optionally, the size
   parameter may be suffixed by one of the following the units designators: 's', 'K', 'M',  or  'G',  for  512
   byte  sectors,  kilobytes,  megabytes, or gigabytes, respectively.  The size of the filesystem may never be
   larger than the size of the partition.  If size parameter is not specified, it will default to the size  of
   the partition.

See man resize2fs for more details.