Linux tip, Fedora tip / howto: Resizing a logical volume

Note that these tips are mostly outdated

back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

Resizing a logical volume

The CentOS installer had created a single 250 GB /home partition on a 320 GB drive, but I wanted to split this into a 150 GB /home and a 100 GB /data partition.

The steps to shrink the /home partition (as root)(my hostname is legion):

  • umount /home
  • fsck -f /home
  • resize2fs -p /dev/vg_legion/lv_home 150G
  • lvresize -L -50G /dev/vg_legion/lv_home
  • mount /home
Next, to create the /data partition:
  • lvcreate -n lv_data -L 100G vg_legion
  • mke2fs -j /dev/vg_legion/lv_data
  • mkdir /data
  • mount /dev/vg_legion/lv_data /data
  • Add an approriate lines to your /etc/fstab:
    /dev/mapper/vg_legion-lv_data /data ext4 defaults 1 2

← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.