Junior — Middle
How can the size of a partition be increased in Linux?
sobes.tech AI
Answer from AI
To increase the size of a partition in Linux, the following steps are usually performed:
- Extend the physical volume or disk (if using LVM or a virtual disk).
- Change the size of the partition using utilities such as
fdisk,parted, orgparted. - Expand the filesystem within the partition, for example using
resize2fsfor ext4 orxfs_growfsfor XFS.
Example for a partition with ext4 filesystem on LVM:
# Extend the physical volume (if needed)
# lvextend -L +10G /dev/mapper/vg0-lv0
# Extend the filesystem
resize2fs /dev/mapper/vg0-lv0
Important: Before modifying partitions, it is recommended to back up data and ensure that the partition is not in use (or mounted in read-only mode).