How-to
Extend a filesystem¶
After you resize a volume, grow its partition and filesystem so the operating system can use the new space. It's done while the filesystem stays mounted.
Before you start¶
- A volume grown to its new size, attached to the instance: see Resize a volume.
- A way to sign in to the instance with administrator rights: see Connect to an instance.
Grow the filesystem¶
Check that the disk shows its new size, and see how it's laid out:
Then follow the case that matches what's on the disk.
A filesystem on the whole disk, as Attach a volume sets up, with no partition under vdb. For ext4:
A partition, such as vdb1, or the boot volume's vda1. Grow the partition first, with its disk and partition number, then the filesystem on it:
XFS, on the whole disk or a partition. xfs_growfs takes the mount point:
LVM, where the volume is a physical volume in a volume group, such as data-vg. Grow the physical volume, then the logical volume and its filesystem together:
Breqwatr's Ubuntu, Debian and AlmaLinux images include growpart.
In PowerShell as Administrator, refresh Windows' view of the disks, then grow the partition to the largest size the disk allows. For drive D:
Update-HostStorageCache
$size = (Get-PartitionSupportedSize -DriveLetter D).SizeMax
Resize-Partition -DriveLetter D -Size $size
NTFS grows with the partition, so there's no separate filesystem step.
Add space with a second volume¶
On Linux with LVM, you can also add space by attaching another volume and adding it to the volume group, instead of growing the first one. Create and attach the new volume, find its device name with lsblk, such as vdc, then:
The filesystem then spans both volumes, so it needs both attached. Snapshots and backups are of one volume at a time: freeze the filesystem while you take one of each volume in the group.
Check it worked¶
- On Linux,
df -h /mnt/datashows the filesystem at its new size. - On Windows,
Get-Volumeshows the drive at its new size.
Related¶
- Resize a volume: grow the volume first.
- Attach a volume: set up a new volume's filesystem.
- Performance efficiency: sizing storage to the workload.