{"id":238,"date":"2010-08-11T11:05:40","date_gmt":"2010-08-11T10:05:40","guid":{"rendered":"http:\/\/kb.toderu.ro\/?p=238"},"modified":"2010-08-11T11:05:40","modified_gmt":"2010-08-11T10:05:40","slug":"lvm","status":"publish","type":"post","link":"https:\/\/kb.toderu.ro\/?p=238","title":{"rendered":"LVM"},"content":{"rendered":"<p>\t\t\t\tCreating Logical Volumes<br \/>\n   1.<br \/>\n      Prepare underlying block devices<br \/>\n            Can use partitions of type 0x8e or software RAID devices<br \/>\n   2.<br \/>\n      Create physical volumes<br \/>\n      # pvcreate \/dev\/hda3<br \/>\n   3.<br \/>\n      Create volume group containing physical volume<br \/>\n      # vgcreate vg0 \/dev\/hda3<br \/>\n   4.<br \/>\n      Create logical volumes inside volume groups<br \/>\n      # lvcreate -L 256M -n data vg0<br \/>\n   5.<br \/>\n      Format and mount logical volume (\/dev\/vg0\/data)<\/p>\n<p>Resizing Logical Volumes<br \/>\n      Growing logical volumes and filesystems<br \/>\n            lvextend can grow logical volumes<br \/>\n            resize2fs can grow ext3 filesystems online or offline<br \/>\n      Shrinking filesystems and logical volumes<br \/>\n            Must be done offline (umount)<br \/>\n            Requires a filesystem check (e2fsck) first<br \/>\n            Filesystem then reduced (resize2fs)<br \/>\n            Lastly, lvreduce can then reduce the volume<\/p>\n<p>Resizing Volume Groups<br \/>\n      Volume Groups can be enlarged with:<br \/>\n      # vgextend vg0 \/dev\/sdb1<br \/>\n      Volume Groups can be reduced with:<br \/>\n      # pvmove \/dev\/hda3<br \/>\n      # vgreduce vg0 \/dev\/hda3<\/p>\n<p>Logical Volume Manager Snapshots<br \/>\n      Snapshots are special Logical Volumes that are an exact copy of an existing Logical Volume at the time the snapshot is created<br \/>\n      Snapshots are perfect for backups and other operations where a temporary copy of an existing dataset is needed<br \/>\n      Snapshots only consume space where they are different from the original Logical Volume<br \/>\n            Snapshots are allocated space at creation but do not use it until changes are made to the original Logical Volume or the Snapshot<br \/>\n            When data is changed on the original Logical Volume the older data is copied to the Snapshot<br \/>\n            Snapshots contain only data that has changed on the original Logical Volume or the Snapshot since the Snapshot was created. <\/p>\n<p>Using LVM Snapshots<br \/>\n1.      Create snapshot of existing Logical Volume<br \/>\n      # lvcreate -l 64 -s -n datasnap \/dev\/vg0\/data<br \/>\n2.      Mount snapshot<br \/>\n      # mkdir -p \/mnt\/datasnap<br \/>\n      # mount -o ro \/dev\/vg0\/datasnap \/mnt\/datasnap<br \/>\n3.      Perform backup<br \/>\n4.      Remove snapshot<br \/>\n      # umount \/mnt\/datasnap<br \/>\n      # lvremove \/dev\/vg0\/datasnap\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating Logical Volumes 1. Prepare underlying block devices Can use partitions of type 0x8e or software RAID devices 2. Create physical volumes # pvcreate \/dev\/hda3 3. Create volume group containing physical volume # vgcreate vg0 \/dev\/hda3 4. Create logical volumes inside volume groups # lvcreate -L 256M -n data vg0 5. Format and mount logical [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-238","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts\/238","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=238"}],"version-history":[{"count":0,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts\/238\/revisions"}],"wp:attachment":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}