When you resize a disk volume on a Linux system, the file system on that volume may not automatically adjust to the new size. To extend the file system to use the new space, you can use the resize2fs
command. Here are the general steps to extend a file system after resizing a disk volume:
- First, check the current size of the file system using the command
df -h
. This will show the current size of the file system and the amount of available space. - Unmount the file system if it is currently mounted. You can use the command
umount /dev/<device>
to unmount the file system. Replace<device>
with the name of the device that contains the file system you want to resize. - Use the command
fdisk /dev/<device>
to enter the fdisk utility. Use thep
command to view the partition table and make sure that the partition you want to resize is the last one. - Use the
d
command to delete the partition you want to resize. - Use the
n
command to create a new partition, and use the same starting sector as the deleted partition. - Use the
w
command to write the changes to the partition table. - Use the command
e2fsck -f /dev/<device>
to check the file system for errors. - Use the command
resize2fs /dev/<device>
to resize the file system. This will extend the file system to use the new space. - Use the
df -h
command to verify that the file system has been extended to the new size. - Finally, remount the file system using the command
mount /dev/<device> /path/to/mountpoint
Please note that these are general steps and you should refer to the official documentation and also make sure to have a backup before starting with any of these steps as a precautionary measure.