Добавить
Уведомления

Session-30 | Logical Volume (LVM) Snapshot Feature | LVM Snapshot in RHEL | Nehra Classes

Create and Restore manual Logical Volume Snapshots 1. Creating a Logical Volume 2. Create a partitions First, we need to create a partitions and mark them as physical volumes. Here is our physical disk we are going to work with: # fdisk -l /dev/sdb 3. Let's create two primary partitions. # fdisk /dev/sdb Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): Using default value 1 First sector (2048-2097151, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +400M Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): 2 First sector (821248-2097151, default 821248): Using default value 821248 Last sector, +sectors or +size{K,M,G} (821248-2097151, default 2097151): +200M Command (m for help): t Partition number (1-4): 1 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. Verify the same by below command. # fdisk -l /dev/sdb 4. Create Physical Volumes # pvcreate /dev/sdb1 # pvcreate /dev/sdb2 5. Create Volume Group Now it is time to create a Volume Group. # vgcreate volume_group /dev/sdb1 /dev/sdb2 verify with #vgs 6. Create Logical Volume # lvcreate -L 200 -n volume1 volume_group verify with: # lvs 7. Now you can create an ext4 filesystem on your logical volume: # mkfs.ext4 /dev/volume_group/volume1 8. First, create a new mount point directory for "volume1" and mount it : # mkdir -p /mnt/volume1 # mount /dev/volume_group/volume1 /mnt/volume1 9. Enter "volume1" mount point and copy some sample data: # cd /mnt/volume1 # cp -r /sbin/ . 10. Verify this data: # du -s sbin/ 8264 sbin/ 10.Creating a Snapshot # lvcreate -s -L 20M -n volume1_snapshot /dev/volume_group/volume1 verify with: # lvs 11. Remove the data you have copied. # rm -rf /mnt/volume1/sbin/ verify with: # du -s /mnt/volume1/sbin 12. Revert Logical Volume Snapshot # lvconvert --merge /dev/volume_group/volume1_snapshot # cd # umount /mnt/volume1 13. Deactivate and activate you volume: # lvchange -a n /dev/volume_group/volume1 # lvchange -a y /dev/volume_group/volume1 14. As a last step mount again your logical volume "volume1" and confirm that data all has been recovered: # mount /dev/volume_group/volume1 /mnt/volume1 # du -s /mnt/volume1/sbin 8264 /mnt/volume1/sbin You have successfully restored the data. Thanks for watching, please share and like. ========================== ***** Join this channel to get access to perks: https://www.youtube.com/channel/UCvk2... ***** My DSLR Camera: https://amzn.to/36954Ml My Boya Microphone: https://amzn.to/3mZavTS My iPhone: https://amzn.to/3lWa63j My Gaming Router: https://amzn.to/3j3dQON My FireStick: https://amzn.to/345150F My Head-Phone: https://amzn.to/3ie4rDB ****** My Dream Laptop: https://amzn.to/37j11fp My Dream TV: https://amzn.to/2KR32b4 My Dream IPhone: https://amzn.to/36j8oE1 ****** Contact Us: WhatsApp: https://bit.ly/2Kpqp5z Telegram Channel: https://t.me/NehraClasses Email: nehraclasses@gmail.com ****** Follow Us On Social Media Platforms: Twitter: https://twitter.com/nehraclasses/ Facebook Page: https://www.facebook.com/nehraclasses/ Instagram: https://www.instagram.com/nehraclasses/ Website: https://nehraclassesonline.business.s... ======= ©COPYRIGHT. ALL RIGHTS RESERVED. #NehraClasses

12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

Create and Restore manual Logical Volume Snapshots 1. Creating a Logical Volume 2. Create a partitions First, we need to create a partitions and mark them as physical volumes. Here is our physical disk we are going to work with: # fdisk -l /dev/sdb 3. Let's create two primary partitions. # fdisk /dev/sdb Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): Using default value 1 First sector (2048-2097151, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +400M Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): 2 First sector (821248-2097151, default 821248): Using default value 821248 Last sector, +sectors or +size{K,M,G} (821248-2097151, default 2097151): +200M Command (m for help): t Partition number (1-4): 1 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. Verify the same by below command. # fdisk -l /dev/sdb 4. Create Physical Volumes # pvcreate /dev/sdb1 # pvcreate /dev/sdb2 5. Create Volume Group Now it is time to create a Volume Group. # vgcreate volume_group /dev/sdb1 /dev/sdb2 verify with #vgs 6. Create Logical Volume # lvcreate -L 200 -n volume1 volume_group verify with: # lvs 7. Now you can create an ext4 filesystem on your logical volume: # mkfs.ext4 /dev/volume_group/volume1 8. First, create a new mount point directory for "volume1" and mount it : # mkdir -p /mnt/volume1 # mount /dev/volume_group/volume1 /mnt/volume1 9. Enter "volume1" mount point and copy some sample data: # cd /mnt/volume1 # cp -r /sbin/ . 10. Verify this data: # du -s sbin/ 8264 sbin/ 10.Creating a Snapshot # lvcreate -s -L 20M -n volume1_snapshot /dev/volume_group/volume1 verify with: # lvs 11. Remove the data you have copied. # rm -rf /mnt/volume1/sbin/ verify with: # du -s /mnt/volume1/sbin 12. Revert Logical Volume Snapshot # lvconvert --merge /dev/volume_group/volume1_snapshot # cd # umount /mnt/volume1 13. Deactivate and activate you volume: # lvchange -a n /dev/volume_group/volume1 # lvchange -a y /dev/volume_group/volume1 14. As a last step mount again your logical volume "volume1" and confirm that data all has been recovered: # mount /dev/volume_group/volume1 /mnt/volume1 # du -s /mnt/volume1/sbin 8264 /mnt/volume1/sbin You have successfully restored the data. Thanks for watching, please share and like. ========================== ***** Join this channel to get access to perks: https://www.youtube.com/channel/UCvk2... ***** My DSLR Camera: https://amzn.to/36954Ml My Boya Microphone: https://amzn.to/3mZavTS My iPhone: https://amzn.to/3lWa63j My Gaming Router: https://amzn.to/3j3dQON My FireStick: https://amzn.to/345150F My Head-Phone: https://amzn.to/3ie4rDB ****** My Dream Laptop: https://amzn.to/37j11fp My Dream TV: https://amzn.to/2KR32b4 My Dream IPhone: https://amzn.to/36j8oE1 ****** Contact Us: WhatsApp: https://bit.ly/2Kpqp5z Telegram Channel: https://t.me/NehraClasses Email: nehraclasses@gmail.com ****** Follow Us On Social Media Platforms: Twitter: https://twitter.com/nehraclasses/ Facebook Page: https://www.facebook.com/nehraclasses/ Instagram: https://www.instagram.com/nehraclasses/ Website: https://nehraclassesonline.business.s... ======= ©COPYRIGHT. ALL RIGHTS RESERVED. #NehraClasses

, чтобы оставлять комментарии