Author:
erics , April 17th, 2023
First, use the AWS Console to modify the volume to the desired size, in our example we want to go from 10GB to 25GB for the root filesystem For a Xen ext4 root volume
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# df -h
Filesystem Size Used Avail Use % Mounted on
/ dev / xvda1 9.8G 9.6G 26M 100 % /
/ dev / xvdf 200G 99G 102G 50 % / volumes / data
# lsblk
NAME MAJ : MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202 : 0 0 10G 0 disk
└─xvda1 202 : 1 0 10G 0 part /
xvdf 202 : 80 0 200G 0 disk / volumes / data
# growpart /dev/xvda 1
CHANGED : disk = / dev / xvda partition = 1 : start = 4096 old : size = 20967390 , end = 20971486 new : size = 52424670 , end = 52428766
# lsblk
lsblk
NAME MAJ : MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202 : 0 0 25G 0 disk
└─xvda1 202 : 1 0 25G 0 part /
xvdf 202 : 80 0 200G 0 disk / volumes / data
# resize2fs /dev/xvda1
resize2fs 1.43.5 ( 04 - Aug - 2017 )
Filesystem at / dev / xvda1 is mounted on / ; on - line resizing required
old_desc_blocks = 1 , new_desc_blocks = 2
The filesystem on / dev / xvda1 is now 6553083 ( 4k ) blocks long .
# df -hT
Filesystem Type Size Used Avail Use % Mounted on
/ dev / xvda1 ext4 25G 9.6G 15G 40 % /
/ dev / xvdf xfs 200G 99G 102G 50 % / volumes / data
For NVMe First, use lsblk to see the raw partitions:
# df -hT
Filesystem Type Size Used Avail Use % Mounted on
/ dev / nvme0n1p1 xfs 20G 2.8G 18G 14 % /
# lsblk
NAME MAJ : MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259 : 0 0 40G 0 disk
├─nvme0n1p1 259 : 1 0 20G 0 part /
└─nvme0n1p128 259 : 2 0 1M 0 part
Note how the partition at 259:1 is only 20GB, […]
Categories: How-To's , Technology Tags: Amazon , Amazon Linux 2 , AWS , df , df -hT , Disk , EBS , Expand , Filesystem , Grow , howto , Linux , Linux2 , lsblk , NVMe , partition , Resize , tips , volume , XFS
| No comments
Author:
erics , February 19th, 2021
First, use lsblk to see the raw partitions:
# df -hT
Filesystem Type Size Used Avail Use % Mounted on
/ dev / nvme0n1p1 xfs 20G 2.8G 18G 14 % /
# lsblk
NAME MAJ : MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259 : 0 0 40G 0 disk
├─nvme0n1p1 259 : 1 0 20G 0 part /
└─nvme0n1p128 259 : 2 0 1M 0 part
Note how the partition at 259:1 is only 20GB, while the entire disk at 259:0 is 40GB. A partition resize is required in this case.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# sudo growpart /dev/nvme0n1 1
CHANGED : partition = 1 start = 4096 old : size = 41938911 end = 41943007 new : size = 83881951 end = 83886047
# lsblk
NAME MAJ : MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259 : 0 0 40G 0 disk
├─nvme0n1p1 259 : 1 0 40G 0 part /
└─nvme0n1p128 259 : 2 0 1M 0 part
# df -hT
Filesystem Type Size Used Avail Use % Mounted on
/ dev / nvme0n1p1 xfs 20G 2.8G 18G 14 % /
# sudo xfs_growfs -d /
meta - data = / dev / nvme0n1p1 isize = 512 agcount = 11 , agsize = 524159 blks
= sectsz = 512 attr = 2 , projid32bit = 1
= crc = 1 finobt = 1 spinodes = 0
data = bsize = 4096 blocks = 5242363 , imaxpct = 25
= sunit = 0 swidth = 0 blks
naming = version 2 bsize = 4096 ascii - ci = 0 ftype = 1
log = internal bsize = 4096 blocks = 2560 , version = 2
= sectsz = 512 sunit = 0 blks , lazy - count = 1
realtime = none extsz = 4096 blocks = 0 , rtextents = 0
data blocks changed from 5242363 to 10485243
# df -hT
/ dev / nvme0n1p1 xfs 40G 2.8G 38G 7 % /
If the XFS tools are not already installed , you can install them as follows :
sudo yum install xfsprogs
For an EXT4 filesystem, use the resize2fs command instead:
sudo resize2fs / dev / nvme0n1p1
For more information, please visit the AMW Docs: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
Categories: How-To's , Technology Tags: Amazon , Amazon Linux 2 , AWS , df , df -hT , Disk , EBS , Expand , Filesystem , Grow , howto , Linux , Linux2 , lsblk , NVMe , partition , Resize , tips , volume , XFS
| No comments
Author:
erics , October 26th, 2011
First, use the AWS management console to create and attach a new volume. Note the device name, in our example /dev/sdf.
# yum install xfsprogs-devel
# mkfs.xfs /dev/sdf
# echo "/dev/sdf /data xfs noatime 0 0" | tee -a /etc/fstab
# mkdir -m 000 /data
# mount /data
# df -h
# mount
You now have a 10 GB (or whatever size you specified) EBS volume mounted under /data with an XFS file system, and it will be automatically mounted if the instance reboots.
Categories: How-To's , Technology Tags: Amazon , AWS , df , Filesystem , howto , mount , tips , volume , XFS
| No comments