Before I did the resize, I had 3 partitions:
root@panda1:/mnt1# gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/sdb: 60062500 sectors, 28.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): B35654BD-05BF-422D-9C13-FA11F69BAFC6
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 60062466
Partitions will be aligned on 2048-sector boundaries
Total free space is 2785 sectors (1.4 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 26734591 12.2 GiB 8300
3 26734592 60061695 15.9 GiB 8200
Command (? for help): i
- partition #1 = EFI System Partition
- partition #2 = the root / filesystem
- partition #3 = swap partition
I first deleted partitions #2, and #3 with the 'd' command. Then recreated partition #2 with the 'n' command, specifying the same start sector as before, and new end sector at the end of the disk. Essentially, I am deleting the swap partition and using that space to extend the / filesystem.
I also used the 'x' command to enter expert mode, then 'c' to change the partition GUID back to what it was before. This was needed because creating the partition #2 again assigned it a new GUID. gdisk also gave the partition the name 'Linux filesystem' but I renamed it back to '' (blank).
At the end it looked like this:
Command (? for help): p
Disk /dev/sdb: 60062500 sectors, 28.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): B35654BD-05BF-422D-9C13-FA11F69BAFC6
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 60062466
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB EF00 EFI System Partition
2 1050624 60062466 28.1 GiB 8300
Command (? for help): i
After this, I then did 'e2fsck -f /dev/sdb2' and 'resize2fs /dev/sdb2'. All of which went fine. I can mount the filesystem and verify everything works.
Note that I did this on a second PC with the first PC's boot drive mounted as /dev/sdb. Then I moved the hard drive back to the first PC.
Problem is: After this is done, it won't boot! PC just shows a black screen. No response to keyboard.