Getting started with Linux: directly Mount LVM partitions in Linux

Source: Internet
Author: User

Getting started with Linux: directly Mount LVM partitions in Linux

Q: I have a USB disk that contains LVM partitions. I want to access these LVM partitions in Linux. How can I mount LVM partitions in Linux?

LVM is a logical volume management tool that allows you to manage disk space using the concepts of logical volumes and volume groups. The biggest advantage of LVM over traditional partitioning is that it elastically allocates space for users and programs without considering the size of each physical disk.

In LVM, physical storage that creates logical partitions is a traditional partition (for example,/dev/sda2,/dev/sdb1 ). These partitions must be initialized as "physical volume PV" and attached with a volume label (for example, "Linux LVM") so that they can be used in LVM. Once the partition is marked as an LVM partition, you cannot directly mount it using the mount command.

  • Use LVM to create elastic disk storage-Part 1
  • Expanding/downgrading LVM in Linux (Part 2)
  • Recording and restoring logical volume snapshots in LVM (part 3)
  • Set a streamlined resource allocation volume in LVM (part 4)
  • Use fragmented I/O to manage multiple LVM disks (Part 5)
  • Disk management-LVM

If you try to mount an LVM partition (such as/dev/sdb2), you will get the following error.

  1. $ mount /dev/sdb2 /mnt
    Mount: unknown filesystem type 'lvm2 _ member'

To mount the LVM partition correctly, you must mount the "logical volume" created in the partition ". The following describes how to do this.

First, run the following command to check available volume groups:

  1. $ sudo pvs
    Pv vg FmtAttrPSizePFree
    /Dev/sdb2 vg_ezsetupsystem40a8f02fadd0 lvm2 a -- 237.60g0

The physical volume name and volume group name are respectively under the PV and VG columns. In this example, there is only one group created under dev/sdb2 "vg_ezsetupsystem40a8f02fadd0 ".

Next, check the logical volumes in the volume group and run the lvdisplay command:

  1. $ sudo lvdisplay <volume-group-name>

Use lvdisplay to display information about available volumes (such as device name, Volume name, volume size, and so on ).

  1. $ sudo lvdisplay /dev/vg_ezsetupsystem40a8f02fadd0
  1. ---Logical volume ---
  2. LV Path/dev/vg_ezsetupsystem40a8f02fadd0/lv_root
  3. LV Name lv_root
  4. VG Name vg_ezsetupsystem40a8f02fadd0
  5. LV UUID imygta-P2rv-2SMU-5ugQ-g99D-A0Cb-m31eet
  6. LV WriteAccess read/write
  7. LV Creation host, time livecd.CentOS,2015-03-1618:38:18-0400
  8. LV Status available
  9. # open 0
  10. LV Size50.00GiB
  11. Current LE 12800
  12. Segments1
  13. Allocation inherit
  14. Read ahead sectors auto
  15. - currently set to 256
  16. Block device 252:0

The two logical volumes are named lv _Root and lv _Home

If you want to mount a specific logical volume, use the following "LV Path" device name (for example:/dev/vg_ezsetupsystem40a8f02fadd0/lv_Home ).

  1. $ sudo mount /dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt

You can use the mount command to check the mount status without any parameters. This will display all mounted file systems.

  1. $ mount

If you want to automatically mount a logical volume at each startup and add the following lines to/etc/fstab, you can specify the file system type (such as ext4) of the volume ), it can be found from the output of the mount command.

  1. /dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt ext4 defaults 00

Now the logical volume is mounted to/mnt each time it is started.

Via: http://ask.xmodulo.com/mount-lvm-partition-linux.html

Author: Dan Nanni Translator: geekpi Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.