I cloned my entire disk to the new disk with dd if=/dev/sdb of=/dev/nvme0n1
. It was a long process so I don't want to repeat it again. I booted from the new disk but there is a problem: the new disk is twice bigger than the old one. When I try to resize my /home partition from live-cd with gnome disks and gparted I get errors.
This is what sudo fsck.ext4 -v /dev/nvme0n1p6
says:
e2fsck 1.46.5 (30-Dec-2021)
The filesystem size (according to the superblock) is 67138671 blocks
The physical size of the device is 67138560 blocks
Either the superblock or the partition table is likely to be corrupt!
My partitons look like this:
/dev/nvme0n1p1 (/)
/dev/nvme0n1p2
/dev/nvme0n1p6 (home)
/dev/nvme0n1p7 (boot)
/dev/nvme0n1p5 (swap)
So, I want to resize nvme0n1p6. How can I do it?
fdisk -l /dev/nvme0n1
result:
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: KINGSTON SKC3000S512G
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: 0x39739d02
Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 * 2048 78127047 78125000 37.3G 83 Linux
/dev/nvme0n1p2 78127102 625141759 547014658 260.8G 5 Extended
/dev/nvme0n1p5 616755200 625141759 8386560 4G 82 Linux swap / Solaris
/dev/nvme0n1p6 78127104 615235583 537108480 256.1G 83 Linux
/dev/nvme0n1p7 615237632 616751103 1513472 739M 83 Linux
P.S. With gparted I extended /dev/nvme0n1p2 to 439GB but I still have 178 unallocated GB. They are just in this union partition now.
New fdisk info:
Device Boot Start End Sectors Size Id Type
/dev/nvme0n1p1 * 2048 78127047 78125000 37.3G 83 Linux
/dev/nvme0n1p2 78127102 1000214527 922087426 439.7G 5 Extended
/dev/nvme0n1p5 616755200 625141759 8386560 4G 82 Linux swap / Solaris
/dev/nvme0n1p6 78127104 615235583 537108480 256.1G 83 Linux
/dev/nvme0n1p7 615237632 616751103 1513472 739M 83 Linux
nvme0n1p6
, which the output offsck.ext4
indicates. Did you attempt to resize this partition before running this command? Based on the sector Start/End locations, output offdisk
showsnvme0n1p6
is 1st,nvme0n1p7
follows ~1MB later, andnvme0n1p5
follows ~2MB after that. So general plan would be to swapoffnvme0n1p5
(swap) , deletenvme0n1p5
, movenvme0n1p7
(boot), resizenvme0n1p6
(home), create swap partition, swapon new swap partition. Finally, increase your home filesystem onnvme0n1p6
. You'll need to edit/etc/fstab
after that.