Skip to content

Instantly share code, notes, and snippets.

@xemoe
Last active December 23, 2017 17:16
Show Gist options
  • Save xemoe/3f9aa83b412d7d665573 to your computer and use it in GitHub Desktop.
Save xemoe/3f9aa83b412d7d665573 to your computer and use it in GitHub Desktop.
Ubunutu server create lvm

http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/

Ubuntu package

sudo apt-get install lvm2

Format partition with type 8e

Create lvm physical volume

sudo pvcreate /dev/sdx1

Create lvm volume group

sudo vgcreate storage_pool /dev/sdx1

Create logical volume

sudo lvcreate -L 1T -n storage storage_pool

Format new logical volume

sudo mkfs -t ext4 /dev/storage_pool/storage

Mount to /storage directory

mkdir /storage
sudo mount -t ext4 /dev/storage_pool/storage /storage

Add to /etc/fstab

# mount log data and index to lvm partition
/dev/storage_pool/storage                 /storage        ext4    defaults        0     1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment