My Fedora 17 (x64 - running on VMware Workstation 8) root filesystem is running out of space (this was an install using the default layout as suggested by the Fedora installer):
# df -h Filesystem Size Used Avail Use% Mounted on rootfs 18G 17G 937M 95% / devtmpfs 1.5G 0 1.5G 0% /dev tmpfs 1.5G 224K 1.5G 1% /dev/shm tmpfs 1.5G 51M 1.5G 4% /run /dev/mapper/vg_bloss-lv_root 18G 17G 937M 95% / tmpfs 1.5G 51M 1.5G 4% /run tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup tmpfs 1.5G 0 1.5G 0% /media /dev/sda2 485M 85M 376M 19% /boot
The bulk of the space is taken up by the /usr
directory. I have added a 40GB disk to the virtual machine (/dev/sdb
) and wish to move /usr
to its own logical volume.
LVM is a bit new to me but I think I've worked out the steps to add this disk using LVM:
fdisk /dev/sdb # (create a new 0x8e LVM partition type using all of the disk) pvcreate /dev/sdb1 vgextend vg_bloss /dev/sdb1 lvcreate -l +100%FREE -n lv_usr vg_bloss /dev/sdb1 mkfs -t ext4 /dev/vg_bloss/lv_usr # mount fs mkdir /mnt/usr mount -t ext4 /dev/vg_bloss/lv_usr /mnt/usr
I was then going to use the following steps to move /usr
onto this new filesystem:
cp -aR /usr/* /mnt/usr umount /mnt/usr # add relevant mount entry in /etc/fstab: # /dev/mapper/vg_bloss-lv_usr /usr ext4 defaults 1 1 mv /usr /usr_old mkdir /usr mount -t ext4 /dev/vg_bloss/lv_usr /usr reboot
Then when I'm happy that /usr
seems intact and behaving normally I'll just delete it to free up space on /
.
Does this look sane?
/
?/
but moving/usr
to it's own LV seemed like the safest bet.lvresize -L+40G /dev/mapper/vg_bloss-lv_root
,resize2fs /dev/mapper/vg_bloss-lv_root
- that's it. no reboot required - nothing.