Difference between revisions of "resize regular luks partition"
From thelinuxwiki
| (7 intermediate revisions by one user not shown) | |||
| Line 3: | Line 3: | ||
Grow the partition size. | Grow the partition size. | ||
| − | + | localhost ~ # '''parted /dev/sdb''' | |
| − | localhost ~ # parted /dev/sdb | + | GNU Parted 3.2 |
| − | GNU Parted 3.2 | + | Using /dev/sdb |
| − | Using /dev/sdb | + | Welcome to GNU Parted! Type 'help' to view a list of commands. |
| − | Welcome to GNU Parted! Type 'help' to view a list of commands. | + | (parted) resizepart 1 |
| − | (parted) resizepart 1 | + | End? [750GB]? 1000GB |
| − | End? [750GB]? 1000GB | + | |
| − | + | ||
Grow the filesystem | Grow the filesystem | ||
| − | + | localhost ~ # '''resize2fs /dev/sdb1''' | |
| − | localhost ~ # resize2fs /dev/sdb1 | + | resize2fs 1.43.1 (08-Jun-2016) |
| − | resize2fs 1.43.1 (08-Jun-2016) | + | resize2fs: Device or resource busy while trying to open /dev/sdb1 |
| − | resize2fs: Device or resource busy while trying to open /dev/sdb1 | + | Couldnt find valid filesystem superblock. |
| − | Couldnt find valid filesystem superblock. | + | |
| − | + | ||
woops, I specified the wrong device name. I need to use the dev mapper name... | woops, I specified the wrong device name. I need to use the dev mapper name... | ||
| − | + | localhost ~ # '''resize2fs /dev/mapper/vol1''' | |
| − | localhost ~ # resize2fs /dev/mapper/vol1 | + | resize2fs 1.43.1 (08-Jun-2016) |
| − | resize2fs 1.43.1 (08-Jun-2016) | + | Please run 'e2fsck -f /dev/mapper/vol1' first. |
| − | Please run 'e2fsck -f /dev/mapper/vol1' first. | + | |
| − | + | ||
whatever you say sir | whatever you say sir | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | localhost ~ # resize2fs /dev/mapper/vol1 | + | localhost ~ # '''e2fsck -f /dev/mapper/vol1''' |
| − | resize2fs 1.43.1 (08-Jun-2016) | + | e2fsck 1.43.1 (08-Jun-2016) |
| − | Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks. | + | Pass 1: Checking inodes, blocks, and sizes |
| − | The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long. | + | Inode 18612229 extent tree (at level 2) could be narrower. Fix<y>? yes |
| + | ... | ||
| + | /dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED ***** | ||
| + | /dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks | ||
| + | localhost ~ # '''resize2fs /dev/mapper/vol1''' | ||
| + | resize2fs 1.43.1 (08-Jun-2016) | ||
| + | Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks. | ||
| + | The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long. | ||
| + | |||
| + | Done! | ||
| − | + | [[category:disk]] | |
Latest revision as of 15:18, 2 August 2025
I replaced a 750GB drive with a 1TB. I copied the old partitions over with dd. The problem is that the partitions didn't make use of the extra space. So, I needed to grow them. There is nothing special about the luks it seems. You just need to decrypt the drive and then proceed as if it was a regular file system. I performed the following steps with it unmounted. You can do it mounted. I just chose not to.
Grow the partition size.
localhost ~ # parted /dev/sdb GNU Parted 3.2 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) resizepart 1 End? [750GB]? 1000GB
Grow the filesystem
localhost ~ # resize2fs /dev/sdb1 resize2fs 1.43.1 (08-Jun-2016) resize2fs: Device or resource busy while trying to open /dev/sdb1 Couldnt find valid filesystem superblock.
woops, I specified the wrong device name. I need to use the dev mapper name...
localhost ~ # resize2fs /dev/mapper/vol1 resize2fs 1.43.1 (08-Jun-2016) Please run 'e2fsck -f /dev/mapper/vol1' first.
whatever you say sir
localhost ~ # e2fsck -f /dev/mapper/vol1 e2fsck 1.43.1 (08-Jun-2016) Pass 1: Checking inodes, blocks, and sizes Inode 18612229 extent tree (at level 2) could be narrower. Fix<y>? yes ... /dev/mapper/vol1: ***** FILE SYSTEM WAS MODIFIED ***** /dev/mapper/vol1: 352906/45793280 files (0.3% non-contiguous), 160544229/183142878 blocks localhost ~ # resize2fs /dev/mapper/vol1 resize2fs 1.43.1 (08-Jun-2016) Resizing the filesystem on /dev/mapper/vol1 to 244139857 (4k) blocks. The filesystem on /dev/mapper/vol1 is now 244139857 (4k) blocks long.
Done!