Note: For all of the below commands, change “sdc” to match your disk’s identifier Convert the new disk to be an LVM physical volume pvcreate /dev/sdc Create the volume group vgcreate vg_extra /dev/sdc Check the volume group vgdisplay Create a logical volume (named lv_logs in this example) lvcreate vg_extra -L 5G -n lv_logs Format the logical volume mkfs.ext4 /dev/mapper/vg_extra-lv_logs Create a directory to mount the new logical volume mkdir /mnt/extra/logs Mount the logical volume mount /dev/mapper/vg_extra-lv_logs /mnt/extra/logs Find the “block id” of the new logical volume blkid /dev/mapper/vg_extra-lv_logs Back up your fstab file to be safe cp /etc/fstab /etc/fstab. Note: Make sure you change “sdb” to the identifier of your drive): pvcreate /dev/sdb Add the new physical volume to the volume group vgextend vg_ubuntu /dev/sdb Check the status vgdisplay Extend the physical volume by 10GB (or however many “GB” you want) lvextend -L +10G /dev/mapper/vg_ubuntu-lv_root Grow the logical volume with ALL of the available space, without specifying a particular size lvextend -resizefs -l +100%FREE /dev/mapper/vg_ubuntu-lv_root Grow the filesystem to match the newly available space resize2fs /dev/mapper/vg_ubuntu-lv_root Check current available space df -h Creating a brand-new LVM setupĪdd a new virtual or physical disk to the server. What Is LVM (Logical Volume Manager) - LVM is a storage manager that allows you to create a single or multiple logical storage volumes across multiple physical. ![]() Traditional partitioning is good, but LVM is better. Convert the new disk to an LVM physical volume Logical Volume Manager (LVM) versus standard partitioning in Linux Use this guide to integrate the flexibility, scalability, and increased features of LVM into your server storage strategies. ![]() First, get a tiny bit of space back for tmp files (this command clears apt caches and etc): sudo apt clean Extend the logical volume lvextend -resizefs -l +100%FREE /dev/mapper/vg_ubuntu-lv_root Adding a disk to LVMĪfter adding a physical or virtual disk to the server, run the following commands.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |