HBA:基于主机的适配器
RAID:Redundent Array of Inexpensive Disks 廉价磁盘阵列
Independent 独立磁盘阵列
Level:仅用于标识磁盘组合方式的不同,不能取代数据备份
raid0:提高读写性能,没有容错能力。至少需要两块磁盘 100%
raid1:至少需要两块硬盘,镜像,硬件容错能力,读性能提升,写性能下降 50%
raid4:至少需要三块硬盘,允许一块盘出错,读写性能提升,(n-1)/n
raid5: 至少需要三块硬盘,允许一块盘出错,读写性能提升,(n-1)/n
raid6: 至少需要四块磁盘,允许两块盘出错。读写性能提升,(n-2)/n
raid10:至少需要四块磁盘。允许不同组内个各坏一块盘,读写性能提升,50%
raid01:
jbod:两个盘结合起来当一个盘用,写完一个盘写另外一个。
md,可以组合任何块设备
mdadm 用户空间工具,管理工具
MD, DM
MD (meta device):通过/dev/md# 将多个物理设备映射成逻辑设备
DM (device meta):将多个物理设备映射成逻辑设备
RAID,LVM2
快照(数据备份) 多路经 动态扩展 逻辑卷可以建立在RAID上
物理卷的管理 : pv
pvcreate /path/to/dev: 初始化一个磁盘或分区创建成为物理卷;
pvmove /path/to/dev: 移动该设备上的物理块到其他设备上.(在移除物理卷时可以使用,防止数据丢失)
pvscan: 搜索目前系统里面任何具有物理卷的磁盘或分区;
pvdisplay: 显示出目前系统上面的物理卷状态;
pvremove /path/to/pv_dev : 将物理卷移除,让该分区不具有物理卷属性。
卷组的管理: vg
格式:vgcrete 卷名 (pv)路径
vgcreate : 创建卷组命令 –s PE大小, 默认4M;
vgscan : 搜索系统上面是否有卷组存在
vgdisplay : 显示目前系统上面的卷组状态;
vgextend : 在卷组内添加额外的物理卷;
vgreduce : 在卷组内移除物理卷;
vgchange : 配置卷组是否启动 (active);
vgremove : 删除一个卷组
逻辑卷的管理: lv
lvcreate : 创建逻辑卷.
lvscan : 查询系统上面的逻辑卷.
lvdisplay : 显示系统上面的逻辑卷状态
lvextend : 在逻辑卷里面添加容量.
lvreduce : 在逻辑卷里面减少容量.
lvremove : 删除一个逻辑卷.
lvresize : 对 LV 进行容量大小的调整.
【
1.fdisk新添加3个分区,并用t调整类型8e--LVM2
/dev/sdb8 923 1837 7349706 8e Linux LVM
/dev/sdb9 1838 2230 3156741 8e Linux LVM
/dev/sdb10 2231 2492 2104483+ 8e Linux LVM
重新读取分区partprobe /dev/sdb 能用cat查看到新建的分区
[[email protected] ~]#cat /proc/partitions
major minor #blocks name
8 16 20971520 sdb
8 17 2104483 sdb1
8 18 1060290 sdb2
8 19 1060290 sdb3
8 20 1 sdb4
8 21 1060258 sdb5
8 22 1060258 sdb6
8 23 1060258 sdb7
8 24 7349706 sdb8
8 25 3156741 sdb9
8 26 2104483 sdb10
2.创建PV
[[email protected] ~]# pvcreate /dev/sdb{8,9}
Physical volume "/dev/sdb8" successfully created ##创建完成
Physical volume "/dev/sdb9" successfully created
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree #空间大小值差在20%内是正常的
/dev/sdb8 lvm2 a-- 7.01g 7.01g
/dev/sdb9 lvm2 a-- 3.01g 3.01g
[[email protected] ~]# pvdisplay #详细显示. pvdisplay /dev/sdb#单独查看某个PV的情况
"/dev/sdb8" is a new physical volume of "7.01 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb8
VG Name
PV Size 7.01 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID dWoqx7-RoC1-3Ol3-xPHv-JS02-zrIa-hfC83O
"/dev/sdb9" is a new physical volume of "3.01 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb9
VG Name
PV Size 3.01 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID xK8eyy-Csbu-2PS0-9XQr-12Or-oalR-Yj0ymk
3.扫描当前有多少个PV
[[email protected] ~]# pvscan
PV /dev/sdb8 lvm2 [7.01 GiB]
PV /dev/sdb9 lvm2 [3.01 GiB]
Total: 2 [10.02 GiB] / in use: 0 [0 ] / in no VG: 2 [10.02 GiB]
4.创建VG
[[email protected] ~]# vgs #查看有几个VG
No volume groups found
[[email protected] ~]# vgcreate myvg /dev/sdb{8,9} #创建VG
Volume group "myvg" successfully created
[[email protected] ~]# vgs #查看有几个VG
VG #PV #LV #SN Attr VSize VFree
myvg 2 0 0 wz--n- 10.02g 10.02g
[[email protected] ~]# vgdisplay myvg #查看VG情况
--- Volume group ---
VG Name myvg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 10.02 GiB
PE Size 4.00 MiB #默认4M
Total PE 2564 #总的PE
Alloc PE / Size 0 / 0
Free PE / Size 2564 / 10.02 GiB #空闲PE
VG UUID wx5HuC-lVCu-zzsT-5MVz-Nu1P-AjEg-zMXdNY
[[email protected] ~]# pvdisplay /dev/sdb8 #再次查看其中一个物理卷,就有VG的值了
--- Physical volume ---
PV Name /dev/sdb8
VG Name myvg
PV Size 7.01 GiB / not usable 1.45 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 1794
Free PE 1794
Allocated PE 0
PV UUID dWoqx7-RoC1-3Ol3-xPHv-JS02-zrIa-hfC83O
5.重新创建一个名为myvg2的8M大小的VG
[[email protected] ~]# vgremove myvg #删除VG
Volume group "myvg" successfully removed
[[email protected] ~]# vgs
No volume groups found
[[email protected] ~]# vgcreate -s 8M myvg2 /dev/sdb{8,9}
Volume group "myvg2" successfully created #重新创建一个名为myvg2的8M大小的VG
[[email protected] ~]# vgdisplay myvg2
--- Volume group ---
VG Name myvg2
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 10.02 GiB
PE Size 8.00 MiB
Total PE 1282
Alloc PE / Size 0 / 0
Free PE / Size 1282 / 10.02 GiB
VG UUID F7icvY-HdsN-DDHt-0GKM-a3ds-FHfG-DnO3lr
6.缩减/扩展VG
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
myvg2 2 0 0 wz--n- 10.02g 10.02g
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb8 myvg2 lvm2 a-- 7.01g 7.01g
/dev/sdb9 myvg2 lvm2 a-- 3.01g 3.01g
(1)缩减VG要先挪走PV
[[email protected] ~]# pvmove /dev/sdb9 #1.先挪走PV
No data to move for myvg2
[[email protected] ~]# vgreduce myvg2 /dev/sdb9 #2.再缩减VG
Removed "/dev/sdb9" from volume group "myvg2"
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
myvg2 1 0 0 wz--n- 7.01g 7.01g
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb8 myvg2 lvm2 a-- 7.01g 7.01g
/dev/sdb9 lvm2 a-- 3.01g 3.01g #/dev/sdb9就不属于myvg2了
[[email protected] ~]# pvremove /dev/sdb9 #3.最后移除/dev/sdb9
Labels on physical volume "/dev/sdb9" successfully wiped
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb8 myvg2 lvm2 a-- 7.01g 7.01g
(2)扩展VG(使用先前准备好的第三个分区)
[[email protected] ~]# pvcreate /dev/sdb10 #1.先创建成PV
Physical volume "/dev/sdb10" successfully created
[[email protected] ~]# vgextend myvg2 /dev/sdb10 #2.把一个物理卷加进VG
Volume group "myvg2" successfully extended
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
myvg2 2 0 0 wz--n- 9.01g 9.01g
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb10 myvg2 lvm2 a-- 2.00g 2.00g #可以看到加进了一个物理卷
/dev/sdb8 myvg2 lvm2 a-- 7.01g 7.01g
7.创建LV
#大小为50M(实际要8的倍数,不是48M就是扩展到56M),名为testlv(测试物理卷),在myvg2中创建
[[email protected] ~]# lvcreate -L 50M -n testlv myvg2
Rounding up size to full physical extent 56.00 MiB
Logical volume "testlv" created
[[email protected] ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
testlv myvg2 -wi-a----- 56.00m
[[email protected] ~]#lvdisplay #查看所有lv的情况
--- Logical volume ---
LV Path /dev/myvg2/testlv
LV Name testlv
VG Name myvg2
LV UUID l0N4NJ-ZiAh-X56l-oVsr-KUWU-rTQ8-IgnJFs
LV Write Access read/write
LV Creation host, time host, 2016-09-07 20:13:48 +0800
LV Status available
# open 0
LV Size 56.00 MiB
Current LE 7
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[[email protected] ~]# lvdisplay /dev/myvg2/testlv #只查看特定的lv情况
--- Logical volume ---
...
LV Status available
# open 0
LV Size 56.00 MiB
Current LE 7
...
8.格式化LV
[[email protected] ~]# mke2fs -j /dev/myvg2/testlv
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=1024 (log=0)
分块大小=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
14336 inodes, 57344 blocks
2867 blocks (5.00%) reserved for the super user
第一个数据块=1
...
正在写入inode表: 完成
Creating journal (4096 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
...
9.挂载/mnt/目录下
[[email protected] ~]# mount /dev/myvg2/testlv /mnt/
[[email protected] ~]# ls /mnt/
lost+found
[[email protected] ~]# mount
......
/dev/sda1 on /boot type ext4 (rw)
/dev/sda2 on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/myvg2-testlv on /mnt type ext3 (rw) #挂载信息上显示的是/dev/myvg2实际地址
[[email protected] ~]# ll /dev/mapper/myvg2-testlv
lrwxrwxrwx. 1 root root 7 9月 7 20:22 /dev/mapper/myvg2-testlv -> ../dm-0
10.卸载LV
[[email protected] ~]# lvremove /dev/mapper/myvg2-testlv #没卸载不能移除
Logical volume myvg2/testlv contains a filesystem in use.
[[email protected] ~]# umount /mnt/ #卸载
[[email protected] ~]# lvremove /dev/mapper/myvg2-testlv #移除物理卷
Do you really want to remove active logical volume testlv? [y/n]: y
Logical volume "testlv" successfully removed
[[email protected] ~]# lvs #卸载完成,没有一个lv
[[email protected] ~]#
】
一、扩展逻辑卷
lvextend -L [+]# /path(物理路径) #先扩展物理边界
resuze2fs #再扩展逻辑边界
resize2fs /path/to/lv 5G #扩展到5G
resize2fs -P /path/to/lv #能扩展到多大就多大
二、缩减逻辑卷
注意:
1.不能在线缩减,先卸载
2.确保缩减后的空间大小是否依然能存储原有的所有数据
3.在缩减之前应该强行检查文件,以确保文件系统处于一致性状态
resize2fs /PATH/TO/PV 3G #逻辑边界先缩减到3G
lvreduce -L # /PATH/TO/PV #物理边界再缩减至3G
强行检查:e2fsck -f
三、快照
1.生命周期为整个数据时长,这段时间内数据的增长不能超出快照卷的大小
2.快照卷应该是只读的
3.跟原卷在同一卷组内
4.快照创建后,对原卷的改变不会影响快照本身
lvcrate
-s:表示快照卷
-p r|w :给权限 读|写
-L:指定大小
-n:指定名称
lvcrate -L # -n SLV_NAME -s -p r /PATH/TO/PV
【①扩展逻辑卷
1.扩展物理边界到2G,名为testlv,在myvg2中创建
[[email protected] ~]# lvcreate -L 2G -n testlv myvg2
Logical volume "testlv" created
2.格式化
[[email protected] ~]# mke2fs -j /dev/myvg2/testlv
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
第一个数据块=0
...
正在写入inode表: 完成
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: m^H完成
...
3.挂载,开机自启动
[[email protected] ~]# mkdir /users
[[email protected] ~]# vim /etc/fstab
/dev/myvg2/testlv /users ext3 defaults,acl 0 0
[[email protected] ~]# mount -a
[[email protected] ~]# mount
....
/dev/mapper/myvg2-testlv on /users type ext3 (rw,acl)
[[email protected] ~]# cd /users
[[email protected] users]# ls
lost+found
[[email protected] users]# cp /etc/inittab .
[[email protected] users]# cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
...
id:3:initdefault:
4.扩展前后df的对比
[[email protected] users]# cd
[[email protected] ~]# df -lh #扩展前的逻辑卷大小为2G
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/myvg2-testlv 2.0G 68M 1.9G 4% /users
[[email protected] ~]# vgs #先查看要扩展的大小是否小于Free值,是否有足够空间可用
VG #PV #LV #SN Attr VSize VFree
myvg2 2 1 0 wz--n- 9.01g 7.01g
[[email protected] ~]# lvextend -L 5G /dev/myvg2/testlv #扩展到5G
Extending logical volume testlv to 5.00 GiB
Logical volume testlv successfully resized
[[email protected] ~]# df -lh #扩展后逻辑卷文件系统大小还是2G
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/myvg2-testlv 2.0G 68M 1.9G 4% /users
[[email protected] ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
testlv myvg2 -wi-ao---- 5.00g #物理边界已经到5G
5. 扩展逻辑边界
[[email protected] ~]# resize2fs -p /dev/myvg2/testlv
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/myvg2/testlv is mounted on /users; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/myvg2/testlv to 1310720 (4k) blocks.
The filesystem on /dev/myvg2/testlv is now 1310720 blocks long.
[[email protected] ~]# df -lh #逻辑边界已经为5G
Filesystem Size Used Avail Use% Mounted on
...
/dev/mapper/myvg2-testlv 5.0G 69M 4.7G 2% /users
[[email protected] ~]# ls /users #扩展后文件仍然存在,仍然可以查看
inittab lost+found
[[email protected] ~]# cat /users/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#...
id:3:initdefault:
】
【②缩减逻辑卷
1.先卸载
[[email protected] ~]# umount /users
[[email protected] ~]# mount
/dev/sda5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/sda2 on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
2.强制检查
[[email protected] ~]# e2fsck -f /dev/myvg2/testlv
e2fsck 1.41.12 (17-May-2010)
第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
/dev/myvg2/testlv: 12/327680 files (0.0% non-contiguous), 38000/1310720 blocks
3.逻辑边界先缩减至3G
[[email protected] ~]# resize2fs /dev/myvg2/testlv 3G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/myvg2/testlv to 786432 (4k) blocks.
The filesystem on /dev/myvg2/testlv is now 786432 blocks long.
4.再缩减物理边界到3G
[[email protected] ~]# lvreduce -L 3G /dev/myvg2/testlv
WARNING: Reducing active logical volume to 3.00 GiB
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce testlv? [y/n]: y
Reducing logical volume testlv to 3.00 GiB
Logical volume testlv successfully resized
5.最后挂载
[[email protected] ~]# mount -a
[[email protected] ~]# mount
/dev/sda5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
/dev/sda2 on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/myvg2-testlv on /users type ext3 (rw,acl) #已挂载上
[[email protected] ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 17G 2.0G 14G 13% /
tmpfs 504M 0 504M 0% /dev/shm
/dev/sda1 194M 28M 157M 15% /boot
/dev/sda2 2.0G 35M 1.8G 2% /home
/dev/mapper/myvg2-testlv 3.0G 68M 2.8G 3% /users
[[email protected] ~]# ls /users/inittab
/users/inittab
[[email protected] ~]# cat /users/inittab #可以查看,说明没有损坏文件
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
....
】
练习
1.创建一个由两个物理卷组成的大小为20G的卷组myvg, 要求PE大小16M.
在该卷组上创建大小为7G的逻辑卷mylv1, 要求其文件系统为ext4, 块大小为2048,
开机自动挂载到/users
2.新建用户openstack, 其家目录为/users/openstack, 切换至openstack用户, 复制一些文件到家目录中
3.缩减mylv1到5G大小, 切换到openstack用户, 确保没有数据丢失
4.对mylv1创建快照卷snap-mylv1, 并通过其备份数据到/tmp/user.tar.bz2;
【
1:创建一个由两个物理卷组成的大小为20G的卷组myvg,要求其PE大小为16M;
而后在此卷组中创建一个大小为5G的逻辑卷LV1,此逻辑卷要
1.能在开机后自动挂载至/users目录,2.且支持ACL功能
创建两个和为20G的物理卷(t类型改为8e——LVM2)
fdisk /dev/sdb
Device Boot Start End Blocks Id System
/dev/sdb5 100 1405 10490413+ 83 Linux LVM
/dev/sdb6 1406 2610 9679131 83 Linux LVM
Command (m for help): W
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[[email protected] ~]# pvcreate /dev/sdb{5,6} #创建PV
Physical volume "/dev/sdb5" successfully created
Physical volume "/dev/sdb6" successfully created
[[email protected] ~]# vgcreate -s 16M myvg /dev/sdb{5,6} #VG下盘区PE大小为16M
Volume group "myvg" successfully created
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
myvg 2 0 0 wz--n- 19.22g 19.22g
[[email protected] ~]#
[[email protected] ~]# lvcreate -L 5G -n LV1 myvg #创建一个大小为5G的逻辑卷LV1
Logical volume "LV1" created
[[email protected] ~]# mke2fs -t ext4 /dev/myvg/LV1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
...
[[email protected] ~]# vim /etc/fstab
/dev/myvg/LV1 /mnt/ ext4 defaults,acl 0 0
2、新建用户openstack,其家目录为/users/openstack,而后切换至openstack用户,复制一些文件至其家目录中;
[[email protected] ~]# useradd -d /users/openstack/ openstack #新建用户openstack, 其家目录为/users/openstack
[[email protected] ~]# mkdir -p /users/openstack
[[email protected] ~]# cp /etc/inittab /users/openstack/ 复制一些/etc/下的文件到家目录中
3、缩减mylv1至5G大小;而后切换至openstack用户,确保其数据没有丢失;
缩减逻辑卷大小思路:
3.1. 卸载卷, 并执行强制检测
#e2fsck -f /path/to/lv_device
3.2. 缩减逻辑边界:
#resize2fs /path/to/lv_device Size
3.3. 缩减物理边界:
#lvreduce -L [-]Size /path/to/vg_name/lvname
3.4. 验证是否正常
[[email protected] ~]# umount /dev/myvg/mylv1 #先卸载卷
[[email protected] ~]# e2fsck -f /dev/myvg2/LV2 #强行检测
e2fsck 1.41.12 (17-May-2010)
第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
/dev/myvg2/LV2: 11/327680 files (0.0% non-contiguous), 55902/1310720 blocks
[[email protected] ~]# resize2fs /dev/myvg2/LV2 5G #缩减逻辑边界到5G
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 1310720 blocks long. Nothing to do!
[[email protected] ~]# lvreduce -L 5G /dev/myvg2/LV2 #缩减物理边界到 5G
New size (320 extents) matches existing size (320 extents)
Run `lvreduce --help‘ for more information.
[[email protected] ~]# lsblk #验证数据
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 3.6G 0 rom
sdb 8:16 0 20G 0 disk
├─sdb5 8:21 0 10G 0 part
│ └─myvg2-LV2 (dm-0) 253:0 0 5G 0 lvm
└─sdb6 8:22 0 9.2G 0 part
4、对mylv1创建快照卷snap-mylv1,并通过其备份数据至/tmp/user.tar.bz2;
lvcrate
-s:表示快照卷 -p r|w :给权限 读|写
-L:指定大小 -n:指定名称
[[email protected] openstack]# lvcreate -s -L 5M -n snap-mylv -p r /dev/myvg2/LV2
Rounding up size to full physical extent 16.00 MiB
Logical volume "snap-mylv" created
[[email protected] openstack]# mount /dev/myvg2/snap-mylv /mnt/
mount: block device /dev/mapper/myvg2-snap--mylv is write-protected, mounting read-only
# 只读挂载
[[email protected] openstack]# tar -jcf /tmp/user.tar.bar.bz2 /users/openstack/
】