{"id":562,"date":"2012-02-29T18:55:00","date_gmt":"2012-03-01T02:55:00","guid":{"rendered":"https:\/\/kb.terabyteunlimited.com\/kb-articles\/how-to-work-with-linux-lvm-volumes-on-the-ifl-boot-disk\/"},"modified":"2021-09-07T15:04:41","modified_gmt":"2021-09-07T22:04:41","slug":"how-to-work-with-linux-lvm-volumes-on-the-ifl-boot-disk","status":"publish","type":"lsvr_kba","link":"https:\/\/www.terabyteunlimited.com\/kb\/kb-articles\/how-to-work-with-linux-lvm-volumes-on-the-ifl-boot-disk\/","title":{"rendered":"How To Work With Linux LVM Volumes On The IFL Boot Disk"},"content":{"rendered":"<p>This article covers LVM (Linux Volume Manager) topics relevant to IFL and <br \/>the IFL Boot Disk. The aticle is divided into 2 sections:<br \/><br \/>Section 1: Working with LVM volumes on the IFL Boot Disk<br \/>Section 2: Creating and restoring images of LVM volumes<br \/><br \/>This document applies to any LVM type for use with IFL.  However, starting \r\nwith <br \/>version 3.22, the TeraByte Drive Imaging suite directly supports \r\ndata-only <br \/>backup\/restore of LVM's that contain a single PV with logical\r\nvolumes that consist <br \/>of consecutive blocks within the LVM partition.  If\r\nspanned or striped logical <br \/>volumes exist, the entire  LVM partition will \r\nbe backed up raw as were all LVM <br \/>partitions prior to 3.22. <br \/><br \/><strong>Section 1: Working with LVM volumes on the IFL Boot Disk:<\/strong><br \/><br \/>By default, the IFL boot disk will not activate any LVM volumes. LVM volumes <br \/>can always be activated manually from the running disk by using the command <br \/>'start-lvm' from the Linux prompt, and can then be deactivated by using the <br \/>command 'stop-lvm'. <br \/><br \/>Activating LVM volumes (if any exist on the system) will create a device file<br \/>for each LVM volume in \/dev\/mapper. Those devices files can be viewed with the<br \/>command 'ls -l \/dev\/mapper'. Once activated, LVM volumes can then be mounted <br \/>(assuming they contain a mountable file system) with commands such as:<br \/><br \/>mount \/dev\/mapper\/vg0-lvol0 \/mnt&nbsp; -&gt; mount logical volume 0 in volume group 0<br \/>mount \/dev\/mapper\/vg0-lvol1 \/mnt&nbsp; -&gt; mount logical volume 1 in volume group 0<br \/><br \/>Note that before LVM volumes can be manually deactivated with the 'stop-lvm'<br \/>command, any mounted LVM volumes must first be unmounted. This situation is<br \/>handled automatically when rebooting or powering down.<br \/><br \/>The IFL Boot Disk can be configured to automatically activate LVM volumes<br \/>on boot. This feature is enabled by creating a custom version of the IFL boot <br \/>media with the makeISO\/HDD\/PXE scripts. The option to activate LVM will<br \/>appear on the IFL Boot Media Settings menu, as well as on the Restore Disc<br \/>Settings menu. With LVM Activation enabled, you will see a message to that <br \/>effect on boot, and it will not be necessary to manually activate LVM as <br \/>described above. However, the 'start-lvm' and 'stop-lvm' commands can still be<br \/>used as needed.<br \/><br \/>Note than when using makeHDD or makePXE to create a custom version, the \/c<br \/>option must be used. Otherwise, the script will create the default version of<br \/>the IFL boot media, and the settings menu will not appear. The \/c option is <br \/>not required when running makeISO, since that script always creates a custom<br \/>version. <br \/><br \/>The complete LVM program is available on the IFL Boot Disk, so that commands <br \/>such as 'lvdisplay' and 'vgdisplay' can be used. All of the LVM programs can <br \/>be listed by typing 'lvm' at the prompt. For additional information on LVM, <br \/>please refer to the man pages available on any Linux system with LVM installed.<br \/>The following web site may also be helpful: http:\/\/sourceware.org\/lvm2<br \/><br \/>As an example, one of the more useful LVM commands is 'lvdisplay', which will <br \/>list all detected LVM volumes on the system, with an output similar to the <br \/>following:<br \/><br \/><font size=\"2\" face=\"courier new,courier,monospace\">ifl:\/tbu# lvdisplay<br \/>&nbsp; --- Logical volume ---<br \/>&nbsp; LV Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/dev\/vg1\/lvol0<br \/>&nbsp; VG Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vg1<br \/>&nbsp; LV UUID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3UnE6T-ef0k-SaYe-C8ZX-D711-TRxy-vfJksa<br \/>&nbsp; LV Write Access&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; read\/write<br \/>&nbsp; LV Status&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; available<br \/>&nbsp; # open&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br \/>&nbsp; LV Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 336.00 MB<br \/>&nbsp; Current LE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 84<br \/>&nbsp; Segments&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br \/>&nbsp; Allocation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inherit<br \/>&nbsp; Read ahead sectors&nbsp;&nbsp;&nbsp;&nbsp; auto<br \/>&nbsp; - currently set to&nbsp;&nbsp;&nbsp;&nbsp; 256<br \/>&nbsp; Block device&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 252:0<br \/><br \/>&nbsp; --- Logical volume ---<br \/>&nbsp; LV Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \/dev\/vg1\/lvol1<br \/>&nbsp; VG Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vg1<br \/>&nbsp; LV UUID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AwGwjm-ud2j-4ABE-lyvn-hPs3-k233-3ZJQ9r<br \/>&nbsp; LV Write Access&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; read\/write<br \/>&nbsp; LV Status&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; available<br \/>&nbsp; # open&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br \/>&nbsp; LV Size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 336.00 MB<br \/>&nbsp; Current LE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 84<br \/>&nbsp; Segments&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br \/>&nbsp; Allocation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inherit<br \/>&nbsp; Read ahead sectors&nbsp;&nbsp;&nbsp;&nbsp; auto<br \/>&nbsp; - currently set to&nbsp;&nbsp;&nbsp;&nbsp; 256<br \/>&nbsp; Block device&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 252:1<br \/><\/font><br \/>Each section represents an LVM volume, and gives the size of each LVM, as <br \/>well as the volume group (vg1 in this case) that each LVM belongs to. The<br \/>command 'blkid' can be used to display additional information about LVMs,<br \/>such as the file system they are formatted with, the volume label, the <br \/>UUID, and the block device number.<br \/><br \/><br \/><strong>Section 2: Creating and restoring images of LVM volumes:<\/strong><br \/><\/p>\r\n  <p>IFL supports creating and restoring images to\/from individual LVM volumes. <br \/>In addition, images created from LVM volumes can be restored to hard drive <br \/>partitions, and images created from partitions can be restored to LVM volumes<br \/>(assuming they will fit). <br \/><br \/>Important: The support for LVMs in IFL is limited to creating and restoring <br \/>individual LVM volumes with the requirement that the underlying LVM structures<br \/>(LVM volume groups, LVM physical volumes) already exist. To be able to do a <br \/>complete restore from scratch of a drive containing one or more&nbsp; LVMs, you <br \/>would need to create an image of the entire hard drive, and then restore that<br \/>image. <br \/><br \/>Once LVMs have been activated on the IFL Boot Disk, the IFL program will <br \/>recognize the LVM volumes as drives, and they will appear in the list of <br \/>drives that IFL displays (e.g. \/dev\/mapper\/vg0-lvol0). LVMs are not <br \/>partitioned, but for imaging purposes, IFL will treat them as a drive with<br \/>a single partition.<br \/><br \/>Creating or restoring an image of an LVM to\/from an LVM is done in the same<br \/>way as you would create or restore an image of a hard drive partition<br \/>to\/from a hard drive. <br \/><br \/>Restoring an image of an LVM to a hard drive partition can be done by<br \/>selecting ONLY the LVM volume itself to restore. In other words, make sure<br \/>that the LVM &quot;full drive&quot; is not selected when you restore the image. From<br \/>the command line, an example would look similar to the following:<br \/><br \/>imagel --r --d:l2@0x1 --f:&quot;\/mnt\/lvmimage.tbi&quot; --sp:0x1 --vb <br \/><br \/>The command line above is restoring the specified image file to the 1st <br \/>partition on Linux drive 2 (--d:l2@0x1). The --sp:0x1 is telling IFL to<br \/>restore ONLY the LVM volume itself, rather than the &quot;full drive&quot;. The <br \/>--sp:0x1 indicates a single partition with partition ID=1. Images of LVMs<br \/>will always contain just a single &quot;partition&quot;.<br \/><br \/>Restoring an image of a single partition to an LVM is done in the same<br \/>manner as restoring it to a partiton.<br \/><br \/>Restoring a single partition from a full drive image to an LVM can be done <br \/>by selecting ONLY that one partition to restore. From the command line, an <br \/>example would look similar to the following:<br \/><br \/>imagel --r --d:l2@0x1 --f:&quot;\/tbu\/sdbfulldrive&quot; --sp:0x2 --vb<br \/><br \/>The command above is restoring a single partition with ID=0x2 from the <br \/>specified full drive image file to Linux drive 2 (--d:l2@0x1), which is<br \/>the LVM. Note that is restoring to the 1st &quot;partition&quot; in the LVM (0x1).<br \/><br \/><\/p>\r\n  <p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>This article covers LVM (Linux Volume Manager) topics relevant to IFL and the IFL Boot Disk. The aticle is divided into 2 sections:Section 1: Working with LVM volumes on the IFL Boot DiskSection 2: Creating and restoring images of LVM volumesThis document applies to any LVM type for use with IFL. However, starting with version [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"lsvr_kba_cat":[1814],"lsvr_kba_tag":[2123],"class_list":["post-562","lsvr_kba","type-lsvr_kba","status-publish","hentry","lsvr_kba_cat-faq-image-for-linux","lsvr_kba_tag-image-for-linux"],"_links":{"self":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba"}],"about":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/types\/lsvr_kba"}],"author":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/comments?post=562"}],"version-history":[{"count":1,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/562\/revisions"}],"predecessor-version":[{"id":6332,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/562\/revisions\/6332"}],"wp:attachment":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/media?parent=562"}],"wp:term":[{"taxonomy":"lsvr_kba_cat","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_cat?post=562"},{"taxonomy":"lsvr_kba_tag","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_tag?post=562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}