linux 邏輯卷等

fei890910發表於2014-01-27
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章