- 최신
- 최다 투표
- 가장 많은 댓글
The error resize2fs: Permission denied to resize filesystem
is key here.
Red Hat's Knoweldgebase (needs a login) addresses this in https://access.redhat.com/solutions/2420621
Can you run sudo dumpe2fs /dev/nvme1n1 | head -20
and what does it say on the Filesystem state:
line? If it's anything other than clean
then this is your problem.
FWIW I spun up a new EC2 instance to match your setup, and it works fine for me (growing an ext4 FS from 5GB -> 10GB), so your method is sound.
[root@ip-172-31-15-154 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme1n1 259:0 0 5G 0 disk /data
nvme0n1 259:1 0 8G 0 disk
├─nvme0n1p1 259:2 0 8G 0 part /
├─nvme0n1p127 259:3 0 1M 0 part
└─nvme0n1p128 259:4 0 10M 0 part /boot/efi
[root@ip-172-31-15-154 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs tmpfs 453M 0 453M 0% /dev/shm
tmpfs tmpfs 182M 444K 181M 1% /run
/dev/nvme0n1p1 xfs 8.0G 1.5G 6.5G 19% /
tmpfs tmpfs 453M 0 453M 0% /tmp
/dev/nvme0n1p128 vfat 10M 1.3M 8.7M 13% /boot/efi
tmpfs tmpfs 91M 0 91M 0% /run/user/1000
/dev/nvme1n1 ext4 4.9G 24K 4.6G 1% /data
[ change the EBS volume size in AWS Console here ]
[root@ip-172-31-15-154 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme1n1 259:0 0 10G 0 disk /data
nvme0n1 259:1 0 8G 0 disk
├─nvme0n1p1 259:2 0 8G 0 part /
├─nvme0n1p127 259:3 0 1M 0 part
└─nvme0n1p128 259:4 0 10M 0 part /boot/efi
[root@ip-172-31-15-154 ~]# resize2fs /dev/nvme1n1
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/nvme1n1 is mounted on /data; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/nvme1n1 is now 2621440 (4k) blocks long.
[root@ip-172-31-15-154 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs tmpfs 453M 0 453M 0% /dev/shm
tmpfs tmpfs 182M 448K 181M 1% /run
/dev/nvme0n1p1 xfs 8.0G 1.5G 6.5G 19% /
tmpfs tmpfs 453M 0 453M 0% /tmp
/dev/nvme0n1p128 vfat 10M 1.3M 8.7M 13% /boot/efi
tmpfs tmpfs 91M 0 91M 0% /run/user/1000
/dev/nvme1n1 ext4 9.8G 24K 9.3G 1% /data
[root@ip-172-31-15-154 ~]# dumpe2fs /dev/nvme1n1 | head -20
dumpe2fs 1.46.5 (30-Dec-2021)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: ef2b157b-0c80-440f-a5e6-604669c2fd50
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean ********** THIS LINE HERE **********
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 655360
Block count: 2621440
Reserved block count: 120585
Overhead clusters: 63273
Free blocks: 2558161
Free inodes: 655349
First block: 0
Block size: 4096
Fragment size: 4096
[root@ip-172-31-15-154 ~]#
I believe you will have to change the size of the partition on the disk first with fdisk
to see the new size. After that you can grow the file system with resize2fs
.
Run fdisk -l /dev/nvme1n1
to see the current disk partitioning.
This guide walks through the process of resizing the partition.
https://geekpeek.net/resize-filesystem-fdisk-resize2fs/
WARNING!!! This can be a dangerous process. I would recommend creating a snapshot of your volume beforehand so that you can recreate your instance if something goes wrong.
Hope this helps!
Thanks for the input! The volume does not have a partition and the AWS docs suggest that shouldn't be a problem.
https://docs.aws.amazon.com/ebs/latest/userguide/recognize-expanded-volume-linux.html
sudo fdisk -l /dev/nvme1n1
Disk /dev/nvme1n1: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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
Disk identifier: 0x00000000
Disk /dev/nvme1n1 doesn't contain a valid partition table
I tried growpart just in case, and of course it says "unable to determine partition type"...
관련 콘텐츠
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 일 년 전
Many thanks indeed for looking into this so generously! Indeed I have
So clearly that would need to be fixed before proceeding.
As a workaround I simply created a new volume with the planned larger size and sync'd everything over, allowing me to delete the old volume.
Again, I really appreciate your willingness to help here.