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.
$ 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:
$ 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:
$ sudo lvdisplay <volume-group-name>
Use lvdisplay to display information about available volumes (such as device name, Volume name, volume size, and so on ).
$ sudo lvdisplay /dev/vg_ezsetupsystem40a8f02fadd0
---Logical volume ---
LV Path/dev/vg_ezsetupsystem40a8f02fadd0/lv_root
LV Name lv_root
VG Name vg_ezsetupsystem40a8f02fadd0
LV UUID imygta-P2rv-2SMU-5ugQ-g99D-A0Cb-m31eet
LV WriteAccess read/write
LV Creation host, time livecd.CentOS,2015-03-1618:38:18-0400
LV Status available
# open 0
LV Size50.00GiB
Current LE 12800
Segments1
Allocation inherit
Read ahead sectors auto
- currently set to 256
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 ).
$ 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.
$ 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.
/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: