Tuesday, August 28, 2007

Increasing the Size of a File System With Linux Logical Volume Manager

Just came across this site and bookmarking it :)


Here are the steps you need to increase your file system using Linux Logical Volume Manager (LVM).

First check the file systems available in LVM and the free space.
# df -k

Check the free space on the disk.
# vgdisplay -v

Check which users are currently logged in to the system.
# who -a

We need to kill all the users before unmounting the file system. The fuser command will show the PIDs using the /home file system.

# fuser -kc /homeKill the processes one by one to remove the users.

# kill -9 pid

Before changing the size, we need to unmount the file system.

# umount /home

Now extend the logical volume first (/home is available in /dev/vg00/lvol5; -L 1024 will increase the size by 1024 MB).

bash-2.04# lvextend -L 1024M /dev/vg00/lvol5

Now extend the file system using the extendfs command, which will increase the file system available in lvol5, that is, /home.

bash-2.04# extendfs /dev/vg00/lvol5

Now mount the file system.

bash-2.04# mount home

Now you can check the file system size by using the following command:

bash-2.04# bdf or bdf

No comments: