10 July, 2023

Logical Volume Manager (LVM)

 Why LVM?

- LVM enables dynamic management of storage volumes in Linux.
- It offers flexibility, scalability, and easier maintenance of disk space.

Let's dive into the commands and unleash the magic of LVM! 💡

1️⃣ Check available disks:

$ lsblk


2️⃣ Create physical volumes (PV):

$ pvcreate /dev/sdb


3️⃣ Create a volume group (VG):

$ vgcreate myvg /dev/sdb


4️⃣ Create logical volumes (LV):

$ lvcreate -L 10G -n mylv myvg


5️⃣ Format the logical volume with a file system:

$ mkfs.ext4 /dev/myvg/mylv


6️⃣ Mount the logical volume:

$ mount /dev/myvg/mylv /mnt/mylv


7️⃣ Update /etc/fstab for automatic mounting:

$ echo '/dev/myvg/mylv /mnt/mylv ext4 defaults 0 0' >> /etc/fstab


8️⃣ Resize the logical volume (if needed):

$ lvresize -L +2G /dev/myvg/mylv


9️⃣ Extend the file system:

$ resize2fs /dev/myvg/mylv


🌟 Congratulations! You have successfully set up and managed your Logical Volume Manager (LVM) in Linux. Enjoy the benefits of dynamic storage management! 🌟



No comments:

Post a Comment

Redirection in IIS

 This config will redirect every request to https://www.domain.com <configuration>     <system.webServer>         <rewrite>...