ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux 逻辑卷等

linux 逻辑卷等

原创 Linux操作系统 作者:fei890910 时间:2014-01-27 16:29:04 0 删除 编辑
linux 逻辑卷的使用

给磁盘分区并添加lvm标示
[root@node1 /]# fdisk /dev/sdb
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         183     1469916   83  Linux
/dev/sdb2             184         366     1469947+  8e  Linux LVM
/dev/sdb3             367        1218     6843690   8e  Linux LVM

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         183     1469916   8e  Linux LVM
/dev/sdb2             184         366     1469947+  8e  Linux LVM
/dev/sdb3             367        1218     6843690   8e  Linux LVM


Command (m for help): w
The partition table has been altered!


Calling ioctl() to re-read partition table.
Syncing disks.

删除卷组合物理卷
[root@node1 /]# vgremove lvm_test
  Volume group "lvm_test" successfully removed
[root@node1 /]# pvremove /dev/sdb2
  Labels on physical volume "/dev/sdb2" successfully wiped
[root@node1 /]# pvremove /dev/sdb1
  Labels on physical volume "/dev/sdb1" successfully wiped

创建物理卷
[root@node1 /]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@node1 /]# pvcreate /dev/sdb2
  Physical volume "/dev/sdb2" successfully created
[root@node1 /]# pvcreate /dev/sdb3
  Physical volume "/dev/sdb3" successfully created
显示物理卷
[root@node1 /]# pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/sda2  VolGroup00 lvm2 a-   19.88G    0 
  /dev/sdb1             lvm2 --    1.40G 1.40G
  /dev/sdb2             lvm2 --    1.40G 1.40G
  /dev/sdb3             lvm2 --    6.53G 6.53G
创建vg并将两个物理卷加入卷组
[root@node1 /]# vgcreate lvm_test /dev/sdb1 /dev/sdb2
  Volume group "lvm_test" successfully created
在现有的卷组上添加一个物理卷
[root@node1 /]# vgextend lvm_test /dev/sdb3
  Volume group "lvm_test" successfully extended
创建逻辑卷
[root@node1 /]# lvcreate -L 1500 -n test lvm_test
  Logical volume "test" created
[root@node1 /]# lvcreate -L 1500 -n test2 lvm_test
  Logical volume "test2" created
[root@node1 /]# lvcreate -L 1500 -n test3 lvm_test
  Logical volume "test3" created

[root@node1 /]# lvs
  LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  LogVol00 VolGroup00 -wi-ao 17.88G                                      
  LogVol01 VolGroup00 -wi-ao  2.00G                                      
  test     lvm_test   -wi-a-  1.46G                                      
  test2    lvm_test   -wi-a-  1.46G                                      
  test3    lvm_test   -wi-a-  1.46G  



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29108064/viewspace-1075955/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-08-15

  • 博文量
    120
  • 访问量
    748588