加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

LVM逻辑卷分区的查看和挂载

(2015-07-21 16:58:27)
标签:

逻辑卷

逻辑分区

逻辑分区挂载

分类: IT相关
LVM是什么

LVM是逻辑盘卷管理(Logical Volume Manager)的简称,它是Linux环境下对磁盘分区进行管理的一种机制,LVM是建立在硬盘和分区之上的一个逻辑层,来提高磁盘分 LVM区管理的灵活性。下面的host代表主机。
host#aptitude install lvm2
#安装lvm包件包。
手动挂载LVM分区(卷组)
host#fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00048d58

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1                       32      256000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              32      121602   976504832   8e  Linux LVM

Disk /dev/mapper/vg_new-root: 979.9 GB, 979856523264 bytes
255 heads, 63 sectors/track, 119127 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_new-swap: 19.0 GB, 18991808512 bytes
255 heads, 63 sectors/track, 2308 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_new-tmp: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
以上看出磁盘sda分区情况,sda1是启动分区/boot,sda2划分了逻辑卷vg_new,分别给了root,swap,tmp.
结合df -h查看分区目录:
host#df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_new-root
                            899G  368G  485G  44% /
tmpfs                   7.8G     7.8G   0% /dev/shm
/dev/sda1             243M  107M  124M  47% /boot
/dev/mapper/vg_new-tmp
                               1008M  224M  734M  24% /tmp

#查看系统检测到的硬盘个数,及其分区情况。
host#vgscan
Reading all physical volumes.  This may take a while...
Found volume group "vg_new" using metadata type lvm2
以上看出逻辑卷vg_new
#查找系统中存在的LVM卷组,并显示找到的卷组列表。
host#lvscan
ACTIVE            '/dev/vg_new/root' [912.56 GiB] inherit
ACTIVE            '/dev/vg_new/tmp' [1.00 GiB] inherit
ACTIVE            '/dev/vg_new/swap' [17.69 GiB] inherit

#查看卷组激活状态,及卷组中有哪些逻辑卷。
host#vgdisplay vg_new | more
 --- Volume group ---
  VG Name               vg_new
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               931.25 GiB
  PE Size               32.00 MiB
  Total PE              29800
  Alloc PE / Size       29800 / 931.25 GiB
  Free  PE / Size       0 / 0
  VG UUID               X2xrJq-mGff-z1g1-XFdz-q84x-mIuZ-sfAicw

#显示所有名为VolGroup00卷组的详细信息,请记住你将要挂载卷组的 VG UUID。
host#vgrename X2xrJq-mGff-z1g1-XFdz-q84x-mIuZ-sfAicw vg001
#卷组重命名,只有未激活的卷组才可重命名!
#为什么要重命名?因为两个卷组名一样,其中一个是无法挂载的。
host#vgscan
..略
#看看是否已重命名。
host#vgchange -ay /dev/vg001
#激活卷组 vg001
host#lvscan
#查看是否已激活
host#mount -t ext3 /dev/vg001/LogVol00 /mnt
#把卷组的一个逻辑卷挂载到 /mnt 目录上。
卸载LVM卷组   
host#umount /mnt
#卸载挂载到 /mnt 目录的分区。
host#vgchange -an /dev/vg001
#把卷组修改成不激活状态。

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有