I have a hard disk of 320GB attached to a debian machine and a new 2TB drive which will be an upgrade for the smaller drive.
I've just tried to clone the smaller drive to the larger drive using the following command:
sudo dd if=/dev/disk5 of=/dev/disk2 bs=4096 conv=sync,noerror
However this has resulted in the 2TB drive showing as 320GB.
When I run (the sda numbers have changed as I did the clone from my mac and then plugged the drive into the debian machine):
sudo fdisk -u /dev/sda1
I get the following output showing that the 2TB drive has shrunk to the smaller drive size.
Disk /dev/sda1: 298.1 GiB, 320071884800 bytes, 625140400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5094580b`
How do I expand the drive to show its full capacity, preferably without having to dd
again as it took a very long time?
I've tried:
sudo resize2fs /dev/sda1
But that doesn't do anything. It gives the following output:
The filesystem is already 78142550 (4k) blocks long. Nothing to do!
UPDATE:
If I run:
sudo fdisk -l
I get the following:
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x54bd406a
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 625142447 625140400 298.1G 83 Linux