·þÎñÆ÷ϵͳ¼¯³É¼°Êý¾Ý·þÎñÖÐÐÄ

 

Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
¡¾æŠ€æœ¯èµ„æ–?uppage=news.asp¡¿¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­>>>

linux´ÅÅ̹ÜÀíϵÁÐÖ®LVMµÄʹÓÃ1

linux´ÅÅ̹ÜÀíϵÁÐÈý£ºLVMµÄʹÓÃ

´ÅÅ̹ÜÀíϵÁÐ

linux´ÅÅ̹ÜÀíϵÁÐÒ»£º´ÅÅÌÅä¶î¹ÜÀí   http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html

linux´ÅÅ̹ÜÀíϵÁжþ£ºÈíRAIDµÄʵÏÖ  http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_041_raid.html

linux´ÅÅ̹ÜÀíϵÁÐÈý£ºLVMµÄʹÓà       http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_042_lvm.html

LVMÊÇʲô

LVMÊÇLinux²Ù×÷ϵͳµÄÂß¼­¾í¹ÜÀíÆ÷¡£ ÏÖÔÚÓÐÁ½¸öLinux°æ±¾µÄLVM,·Ö±ðÊÇ LVM1,LVM2¡£LVM1ÊÇÒ»ÖÖÒѾ­±»ÈÏΪÎȶ¨Á˼¸ÄêµÄ³ÉÊì²úÆ·£¬LVM2 ÊÇ×îÐÂ×îºÃµÄLVM°æ±¾¡£ LVM2¼¸ºõÍêÈ«Ïòºó¼æÈÝʹÓÃLVM1´´½¨µÄ¾í¡£´ËÀýÍâÊÇ¿ìÕÕ£¨ÔÚÉý¼¶µ½LVM 2֮ǰ£¬±ØÐëɾ³ý¿ìÕÕ¾í£©¡£

LVM¼ò½é

Âß¼­¾í¹ÜÀíÌṩÁ˱ȴ«Í³µÄ´ÅÅ̺ͷÖÇøÊÓͼ¸ü¸ß¼¶±ðµÄ¼ÆËã»úϵͳÉÏ´ÅÅÌ´æ´¢µÄÊÓͼ¡£ ÕâʹµÃϵͳ¹ÜÀíÔ±¿ÉÒÔ¸üÁé»îµØ½«´æ´¢·ÖÅä¸øÓ¦ÓóÌÐòºÍÓû§¡£

ÔÚÂß¼­¾í¹ÜÀíÆ÷µÄ¿ØÖÆÏ´´½¨µÄ´æ´¢¾í¿ÉÒÔËæÒâµ÷Õû´óСºÍÒƶ¯£¬¾¡¹ÜÕâ¿ÉÄÜÐèÒª¶ÔÎļþϵͳ¹¤¾ß½øÐÐһЩÉý¼¶¡£

Âß¼­¾í¹ÜÀíÆ÷»¹ÔÊÐí¹ÜÀíÓû§¶¨Òå×éÖеĴ洢¾í£¬ÔÊÐíϵͳ¹ÜÀíÔ±´¦ÀíÃ÷ÏÔÃüÃûµÄ¾í×飨Èç¡°development¡±ºÍ¡°sales¡±£©£¬¶ø²»ÊÇÎïÀí´ÅÅÌÃû³Æ£¬ÀýÈç¡°sda¡±ºÍ¡°sdb¡±

LVM»ù±¾ÊõÓï

volume group (VG) 

¾í×éÊÇLVMÖÐʹÓõÄ×î¸ß¼¶±ðµÄ³éÏó¡£ Ëü½«Âß¼­¾íºÍÎïÀí¾í¼¯ºÏÔÚÒ»Æð³ÉΪһ¸ö¹ÜÀíµ¥Ôª¡£

physical volume (PV)

Ò»¸öÎïÀí¾íͨ³£ÊÇÒ»¸öÓ²ÅÌ£¬ËäÈ»Ëü¿ÉÄÜÖ»ÊÇÒ»¸ö¿´ÆðÀ´ÏñÒ»¸öÓ²ÅÌ£¨ÈçÈí¼þRAIDÉ豸£©µÄÉ豸¡£

logical volume (LV)

Ï൱ÓÚ·ÇLVMϵͳÖеĴÅÅÌ·ÖÇø¡£ LV×÷Ϊ±ê×¼¿éÉ豸¿É¼û Òò´ËLV¿ÉÒÔ°üº¬Îļþϵͳ£¨ÀýÈç/ home£©¡£

physical extent (PE) 

ÿ¸öÎïÀí¾í¶¼±»»®·ÖΪÊý¾Ý¿é£¨³ÆΪÎïÀíÀ©Õ¹ÅÌÇø£©£¬ÕâЩÀ©Õ¹ÅÌÇøÓë¾í×éµÄÂß¼­ÅÌÇø¾ßÓÐÏàͬµÄ´óС¡£

logical extent (LE)

ÿ¸öÂß¼­¾í¶¼±»·Ö¸î³ÉÊý¾Ý¿é£¬³ÆΪÂß¼­ÅÌÇø¡£ ¾í×éÖеÄËùÓÐÂß¼­¾íµÄÇø¶Î´óС¶¼ÊÇÏàͬµÄ¡£

¼¸¸ö¸ÅÄîµÄ¹Øϵ

Ò»¸ö¾ßÌåµÄÀý×Ó½«ÓÐÖúÓÚ£º

¼ÙÉèÎÒÃÇÓÐÒ»¸öÃûΪVG1µÄ¾í×飬Õâ¸ö¾í×éµÄÎïÀíÅÌÇø´óСΪ4MB¡£ ÔÚÕâ¸ö¾í×éÖУ¬ÎÒÃÇÒýÈëÁË2¸öÓ²ÅÌ·ÖÇø/dev/hda1ºÍ/dev/hdb1¡£ 
ÕâЩ·ÖÇø½«³ÉΪÎïÀí¾íPV1ºÍPV2£¨¹ÜÀíÔ±¿ÉÒÔ×ÔÐоö¶¨ÊÇ·ñÌṩ¸üÓÐÒâÒåµÄÃû³Æ£©¡£
PV±»·Ö³É4MB¿é£¬ÒòΪÕâÊǾí×éµÄ´óС¡£´ÅÅÌ´óС²»Í¬£¬ÎÒÃÇÔÚPV1ÖлñµÃ99¸öÀ©Õ¹ÅÌÇø£¬ÔÚPV2ÖлñµÃ248¸öÀ©Õ¹ÅÌÇø¡£ 
ÎÒÃÇÏÖÔÚ¿ÉÒÔ´´½¨×Ô¼ºµÄÂß¼­¾í£¬Ëü¿ÉÒÔÊÇ1µ½347£¨248 + 99£©·¶Î§Ö®¼äµÄÈκδóС¡£ 
µ±´´½¨Âß¼­¾íʱ£¬ÔÚÂß¼­ÅÌÇøºÍÎïÀíÅÌÇøÖ®¼ä¶¨ÒåÓ³É䣬ÀýÈ磬 Âß¼­ÅÌÇø1¿ÉÒÔÓ³Éäµ½PV1µÄÎïÀíÅÌÇø51ÉÏ£¬Ð´ÈëÂß¼­Å̵ĵÚÒ»¸ö4MBµÄÊý¾Ýʵ¼ÊÉϱ»Ð´Èëµ½PV1µÄµÚ51ÅÌÇø¡£

Ó³Éäģʽ

ÏßÐÔÓ³Éä : ½«·ÖÅäÒ»¶¨·¶Î§µÄPEµ½LVµÄÒ»¸öÇøÓò£¬ÀýÈçLE 1 - 99Ó³Éäµ½PV1£¬LE 100 - 347Ó³Éäµ½PV2¡£

·ÖÌõÓ³Éä : ½«¿ç¶à¸öÎïÀí¾í½»Ö¯Âß¼­ÅÌÇøµÄ¿é£¬Õâ¸ö·½Ê½Ò»¶¨³Ì¶ÈÉÏÌá¸ßÁËÐÔÄÜ£¬¾ßÌåÈçÏÂ

¡¡¡¡1st chunk of LE[1] -> PV1[1], #µÚÒ»¸öÂß¼­¿éÔÚPV1É豸ÉÏ£¬ µÚ¶þ¸öÔÚPV2É豸ÉÏ£¬µÈµÈ¡£
¡¡¡¡2nd chunk of LE[1] -> PV2[1],
¡¡¡¡3rd chunk of LE[1] -> PV3[1],
¡¡¡¡4th chunk of LE[1] -> PV1[2],

Snapshots(¿ìÕÕ£©£º

ÕâÊÇLVMÌṩµÄÒ»¸ö·Ç³£°ôµÄ¹¦ÄܾÍÊÇ¿ìÕÕÁË£¬ËûÔÊÐí¹ÜÀíÔ±´´½¨Ò»¸öеĿéÉ豸À´³ÊÏÖÒ»¸öÂß¼­¾íµÄµÄ¾«È·¸±±¾£¬ÔÚij¸öʱ¼ä¶³½á£¬¹ÜÀíÔ±¿ÉÒÔ¼°Ê±±¸·ÝÖ¸¶¨Ò»ÖÂ״̬ϵÄÊý¾Ý£¬±¸·ÝÍê±Ï¾Í¿ÉÒÔɾ³ýÉ豸ÁË¡£

¿ìÕÕ×î³õ°üº¬ÓйؿìÕÕµÄһЩԪÊý¾Ý£¬µ«Ã»ÓÐÀ´×ÔÔ´Âß¼­¾íµÄʵ¼ÊÊý¾Ý¡£¿ìÕÕʹÓÃдʱ¸´ÖÆ£¨copy on write£©¼¼ÊõÀ´¼ì²âÊý¾ÝÔÚԭʼÊý¾Ý¿éÖкÎʱ¸ü¸Ä¡£Ëü½«ÅÄÉã¿ìÕÕʱ±£´æµÄÖµ¸´ÖƵ½¿ìÕÕ¾íÖеĿéÖУ¬È»ºóÔÊÐí½«ÐÂÊý¾Ý´æ´¢ÔÚÔ´¿éÖС£

Ëæןü¶à¿é´ÓÔ´Âß¼­¾íÉϵÄԭʼֵ·¢Éú¸ü¸Ä£¬¿ìÕÕ´óСҲ»áÔö¼Ó¡£Èç¹û¿ìÕÕ¾í±äÂú£¬Ëü½«±»¶ªÆú£¬ËùÒÔ·ÖÅä×ã¹»µÄ¿Õ¼äÊǷdz£ÖØÒªµÄ£¬¾ßÌåÈ¡¾öÓÚÄãÊý¾ÝµÄ±ä»»Çé¿ö£¬Èç¹û¿ìÕÕ´óСºÍԭʼÊý¾ÝÒ»Ñù´ó£¬Ëü½«ÓÀÔ¶²»»áÒç³öµÄ¡£

°²×°LVM

[root@centos7 ~]$ rpm -q lvm2                           # ²é¿´lvm2ÊÇ·ñ°²×°ÁË£¬ ÎÒʹÓõÄcentos7£¬ÕâÊÇ°²×°µÄÁË    
lvm2-2.02.171-8.el7.x86_64    
[root@centos7 ~]$ # yum -y install lvm2                 # ûÓа²×°µÄ»°Ê¹ÓÃyum°²×°

³£ÓÃÃüÁî¼ò½é

¸´ÖÆ´úÂë
[root@centos7 ~]$ pv                                                   # ʹÓÃtab°´¼ü»ñÈ¡pvÏà¹ØÃüÁî    
pvchange   pvck       pvcreate   pvdisplay  pvmove     pvremove   pvresize   pvs        pvscan    
[root@centos7 ~]$ vg                                                   # ʹÓÃtabl°´¼ü»ñÈ¡vgÏà¹ØµÄÃüÁî    
vgcfgbackup    vgck           vgdisplay      vgimport       vgmknodes      vgrename       vgsplit    
vgcfgrestore   vgconvert      vgexport       vgimportclone  vgreduce       vgs                
vgchange       vgcreate       vgextend       vgmerge        vgremove       vgscan             
[root@centos7 ~]$ lv                                                   # ʹÓÃtabl°´¼ü»ñÈ¡lvÏȹصÄÃüÁî    
lvchange     lvdisplay    lvmconf      lvmdump      lvmsadc      lvremove     lvs              
lvconvert    lvextend     lvmconfig    lvmetad      lvmsar       lvrename     lvscan           
lvcreate     lvm          lvmdiskscan  lvmpolld     lvreduce     lvresize   
¸´ÖÆ´úÂë

ÉÏÃæµÄÃüÁî±È½Ï¶à£¬¼òµ¥½éÉܼ¸¸ö³£ÓõÄÃüÁî¡£

  • pv´òÍ·µÄ£º´ú±ípvÏà¹ØµÄÃüÁî
  • vg´øÍ·µÄ£º´ú±ívgÏà¹ØµÄÃüÁî
  • lv´øÍ·µÄ£º ´ú±ílvÏà¹ØµÄÃüÁî
  • create:´´½¨Ïà¹Ø
  • remove:ÒƳýÏà¹Ø
  • display:ÏÔʾÏà¹Ø
  • import:µ¼Èë Ïà¹Ø
  • export:µ¼³öÏà¹Ø
  • rename:ÖØÃüÃû
  • vgchange:¸Ä±ä״̬Ïà¹Ø
  • extend:À©Õ¹Ïà¹Ø
  • reduce:Ëõ½øÏà¹Ø

ʹÓÃLVM

pv´´½¨

pv×÷Ó㺳õʼ»¯´ÅÅ̺ʹÅÅÌ·ÖÇø

ÔÚ½«´ÅÅÌ»òÕß´ÅÅÌ·ÖÇøÓÃ×÷ÎïÀí¾í£¨PV£©Ö®Ç°£¬ÄãÐèÒª¶ÔÆä½øÐгõʼ»¯¹¤×÷¡£

[root@centos7 ~]$ pvcreate /dev/sdb1

×¢Ò⣺

  1. ²»½¨Òé¶ÔÕû¸ö´ÅÅÌ×öPV³õʼ»¯¹¤×÷¡£ÒòΪÆäËû²Ù×÷ϵͳ²»ÄÜʶ±ðLVMÔªÊý¾Ý£¬µ¼ÖÂÎÒÃÇÈÏΪ´ÅÅÌÊÇ¿ÕÏеģ¬ÖØÐÂÉèÖ÷ÖÇø¸²¸ÇÔ­ÓÐÊý¾Ý
  2.  Èç¹ûÊÇ·ÖÇøÐèÒªµ÷Õû·ÖÇøµÄÀàÐÍΪLVM(´úÂëΪ8e)

·ÖÇø²¢ÉèÖ÷ÖÇøÀàÐÍ

¸´ÖÆ´úÂë
[root@centos7 ~]$ fdisk -l    

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors    
Units = sectors of 1 * 512 = 512 bytes    
Sector size (logical/physical): 512 bytes / 512 bytes    
I/O size (minimum/optimal): 512 bytes / 512 bytes    
Disk label type: dos    
Disk identifier: 0x000b0b8a    

   Device Boot      Start         End      Blocks   Id  System    
/dev/sda1   *        2048     2099199     1048576   83  Linux    
/dev/sda2         2099200   270534655   134217728   83  Linux    
/dev/sda3       270534656   372934655    51200000   83  Linux    
/dev/sda4       372934656   419430399    23247872    5  Extended    
/dev/sda5       372938752   413898751    20480000   83  Linux    

Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors    
Units = sectors of 1 * 512 = 512 bytes    
Sector size (logical/physical): 512 bytes / 512 bytes    
I/O size (minimum/optimal): 512 bytes / 512 bytes    
Disk label type: dos    
Disk identifier: 0x93d380cf    

   Device Boot      Start         End      Blocks   Id  System    
/dev/sdb1            2048     2099199     1048576   8e  Linux LVM    
/dev/sdb2         2099200     4196351     1048576   8e  Linux LVM    

Disk /dev/sde: 21.5 GB, 21474836480 bytes, 41943040 sectors    
Units = sectors of 1 * 512 = 512 bytes    
Sector size (logical/physical): 512 bytes / 512 bytes    
I/O size (minimum/optimal): 512 bytes / 512 bytes    
Disk label type: dos    
Disk identifier: 0x73afb36f    

   Device Boot      Start         End      Blocks   Id  System    
/dev/sde1            2048     2099199     1048576   8e  Linux LVM    
/dev/sde2         2099200     6293503     2097152   8e  Linux LVM    

Disk /dev/sdd: 21.5 GB, 21474836480 bytes, 41943040 sectors    
Units = sectors of 1 * 512 = 512 bytes    
Sector size (logical/physical): 512 bytes / 512 bytes    
I/O size (minimum/optimal): 512 bytes / 512 bytes    
Disk label type: dos    
Disk identifier: 0x7e0900d8    

   Device Boot      Start         End      Blocks   Id  System    
/dev/sdd1            2048     2099199     1048576   8e  Linux LVM    
/dev/sdd2         2099200    12584959     5242880   8e  Linux LVM    

Disk /dev/sdc: 21.5 GB, 21474836480 bytes, 41943040 sectors    
Units = sectors of 1 * 512 = 512 bytes    
Sector size (logical/physical): 512 bytes / 512 bytes    
I/O size (minimum/optimal): 512 bytes / 512 bytes    
Disk label type: dos    
Disk identifier: 0xc56b90d8    

   Device Boot      Start         End      Blocks   Id  System    
/dev/sdc1            2048     2099199     1048576   8e  Linux LVM    
/dev/sdc2         2099200     4196351     1048576   8e  Linux LVM    

Disk /dev/sdf: 21.5 GB, 21474836480 bytes, 41943040 sectors    
Units = sectors of 1 * 512 = 512 bytes    
Sector size (logical/physical): 512 bytes / 512 bytes    
I/O size (minimum/optimal): 512 bytes / 512 bytes    

[root@centos7 ~]$ partprobe     
Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.    
[root@centos7 ~]$ lsblk    
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT    
sda      8:0    0  200G  0 disk     
©À©¤sda1   8:1    0    1G  0 part /boot    
©À©¤sda2   8:2    0  128G  0 part     
©À©¤sda3   8:3    0 48.8G  0 part /    
©À©¤sda4   8:4    0  512B  0 part     
©¸©¤sda5   8:5    0 19.5G  0 part /app    
sdb      8:16   0  100G  0 disk     
©À©¤sdb1   8:17   0    1G  0 part     
©¸©¤sdb2   8:18   0    1G  0 part     
sdc      8:32   0   20G  0 disk     
©À©¤sdc1   8:33   0    1G  0 part     
©¸©¤sdc2   8:34   0    1G  0 part     
sdd      8:48   0   20G  0 disk     
©À©¤sdd1   8:49   0    1G  0 part     
©¸©¤sdd2   8:50   0    5G  0 part     
sde      8:64   0   20G  0 disk     
©À©¤sde1   8:65   0    1G  0 part     
©¸©¤sde2   8:66   0    2G  0 part     
sdf      8:80   0   20G  0 disk     
sr0     11:0    1  8.1G  0 rom  /run/media/root/CentOS 7 x86_64
¸´ÖÆ´úÂë

ÉÏÃæÎÒÃÇÔÚ/dev/sd{b,c,d,e}Õâ4¸öÅÌÿ¸ö¶¼ÓÐ2¸öÀàÐÍΪlvmµÄÅÌ¡£½ÓÏÂÀ´Ê¹ÓÃpvcreat³õʼ»¯ÎªÎïÀí¾í

¸´ÖÆ´úÂë
[root@centos7 ~]$ pvcreate /dev/sd{b1,b2,c1,c2,d1,d2,e1,e2} -y        # ÕâÀï¼ÓÈëÁË-yÑ¡Ï֮ǰµÄÅÌÓÐÎļþϵͳµÄ¡£ ÎÒÕâÀïÇ¿ÖÆ´´½¨ÁË    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Wiping xfs_external_log signature on /dev/sdb2.    
  Physical volume "/dev/sdb1" successfully created.    
  Physical volume "/dev/sdb2" successfully created.    
  Physical volume "/dev/sdc1" successfully created.    
  Physical volume "/dev/sdc2" successfully created.    
  Physical volume "/dev/sdd1" successfully created.    
  Physical volume "/dev/sdd2" successfully created.    
  Physical volume "/dev/sde1" successfully created.    
  Physical volume "/dev/sde2" successfully created.
¸´ÖÆ´úÂë

pvÐÅÏ¢²é¿´

¸´ÖÆ´úÂë
[root@centos7 ~]$ pvs                                           # ÏêϸÐÅÏ¢¿ÉÒÔʹÓÃpvdisplay²é¿´    
  PV         VG         Fmt  Attr PSize    PFree       
  /dev/sdb1  vg_test_01 lvm2 a  1020.00m 1020.00m    
  /dev/sdb2             lvm2 -     1.00g    1.00g    
  /dev/sdc1  vg_test_01 lvm2 a  1020.00m 1020.00m    
  /dev/sdc2             lvm2 -     1.00g    1.00g    
  /dev/sdd1  vg_test_01 lvm2 a  1020.00m 1020.00m    
  /dev/sdd2             lvm2 -     5.00g    5.00g    
  /dev/sde1  vg_test_01 lvm2 a  1020.00m 1020.00m    
  /dev/sde2             lvm2 -     2.00g    2.00g
¸´ÖÆ´úÂë

vg´´½¨

vgµÄ´´½¨ÊDZȽϼòµ¥µÄ¡£

[root@centos7 ~]$ vgcreate  vg_test_01 /dev/sd{b1,c1,d1,e1}    # ÉÏÃæÎÒÃÇ´´½¨ÁË8¸öpv£¬ÕâÀïÎÒÃÇʹÓÃ4¸ö1µÄÉ豸ȥ´´½¨vg,´´½¨ºóĬÈÏvgÊǼ¤»î״̬µÄ    
  Volume group "vg_test_01" successfully created

vgÐÅÏ¢µÄ²é¿´

¸´ÖÆ´úÂë
[root@centos7 ~]$ vgs                                 # ²é¿´¼ò¶ÌµÄÐÅÏ¢    
  VG         #PV #LV #SN Attr   VSize VFree    
  vg_test_01   4   0   0 wzn- 3.98g 3.98g    
[root@centos7 ~]$ vgdisplay                           # ²é¿´ÏêϸµÄÐÅÏ¢    
  - Volume group -    
  VG Name               vg_test_01                    # vgµÄÃû×Ö    
  System ID                 
  Format                lvm2                          # lvm¸ñʽ£¬ ÕâÀïÊÇlvm2µÄ    
  Metadata Areas        4    
  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                4    
  Act PV                4    
  VG Size               3.98 GiB                       # ÕâÊÇÎÒÃÇ4¸öpvµÄ×Ü´óС    
  PE Size               4.00 MiB                       # peµÄ´óС    
  Total PE              1020    
  Alloc PE / Size       0 / 0                          # ·ÖÅäµÄ´óС£¬ÕâÀïÎÒÃÇ»¹Ã»Óд´½¨lv£¬ËùÒÔΪ0    
  Free  PE / Size       1020 / 3.98 GiB                # ·ÖÅäºóÊ£ÓàµÄ¿Õ¼ä£¬µÚÒ»¸öÊýÊÇÊ£ÓàµÄ¸öÊý£¬µÚ¶þ¸öÊýÊÇÊ£ÓàµÄ¿Õ¼ä´óС£¬2¸ö¶¼ÊÇÊ£ÓàµÄÖ»Êǵ¥Î»±íʾ²»Ò»Ñù¶øÒÑ    
  VG UUID               Y5NjjP-e3Aq-3u6E-gw6P-fLyy-Y5pN-ryyN9R  # vgÉ豸µÄuuid
¸´ÖÆ´úÂë

vgµÄ¼¤»î

[root@centos7 ~]$ vgchange -a y vg_test_01                               # ÎÒÃÇÉÏÃæ¾ÍÊǼ¤»î״̬µÄ£¬Èç¹ûÎÒÃÇÖØÆôϵͳ£¬»òÕßvgchange -y nÃüÁî¹Ø±ÕÁË£¬¾ÍÐèÒªÕâ¸öÃüÁîÆô¶¯Ï    
  0 logical volume(s) in volume group "vg_test_01" now active

vgµÄÒƳý

[root@centos7 ~]$ vgchange -a n vg_test_01                       # ÒªÏëÒƳývg£¬ÐèÒªÏȹرÕvg²ÅÄÜÒƳý£¬ÕâÀïÏÈ¹Ø±Õ    
  0 logical volume(s) in volume group "vg_test_01" now active    
[root@centos7 ~]$ vgremove  vg_test_01                           # ÒƳývg,

vgµÄÌí¼Ó³ÉÔ±

[root@centos7 ~]$ vgcreate  vg_test_01 /dev/sd{b1,c1,d1,e1}       # ÉÏÃæÎÒ°ÑvgɾÁË£¬ÕâÀïÖØÐÂÌí¼Ó½øÀ´    
  Volume group "vg_test_01" successfully created    
[root@centos7 ~]$ vgextend vg_test_01  /dev/sdb2                  # Ìí¼ÓÒ»¸öpv2µ½vgÖÐÀ´    
  Volume group "vg_test_01" successfully extended

vgµÄɾ³ý³ÉÔ±

Õâ¸ö²Ù×÷ÐèҪʹÓÃvgdisplay²é¿´vgµÄʹÓÃÇé¿öºÍɾ³ýµÄpvÉÏûÓÐÊý¾Ý¡£Èç¹ûÓÐʹÓÃpvmoveǨÒÆÍê±ÏÊý¾Ý²ÅÄÜÒƳý¡£

[root@centos7 ~]$ vgreduce  vg_test_01  /dev/sdb2    
  Removed "/dev/sdb2" from volume group "vg_test_01"

lvµÄ´´½¨

¸´ÖÆ´úÂë
[root@centos7 ~]$ vgdisplay                        # lvÂß¼­¾í´´½¨Ö®Ç°£¬ ÐèÒª²é¿´ÏÂvgÐÅÏ¢    
  - Volume group -    
  VG Name               vg_test_01    
  System ID                 
  Format                lvm2    
  Metadata Areas        4    
  Metadata Sequence No  3    
  VG Access             read/write    
  VG Status             resizable    
  MAX LV                0    
  Cur LV                0    
  Open LV               0    
  Max PV                0    
  Cur PV                4    
  Act PV                4    
  VG Size               3.98 GiB    
  PE Size               4.00 MiB    
  Total PE              1020    
  Alloc PE / Size       0 / 0       
  Free  PE / Size       1020 / 3.98 GiB    
  VG UUID               sZwHea-LabA-SJaV-Wz40-qFp3-Um2w-pvmJAY    
       
[root@centos7 ~]$ lvcreate -L 2G  -n lv_test_01 vg_test_01                 # ÎÒÃǵÄvgÊǽü4GµÄ£¬ÎÒÕâÀï´´½¨Ò»¸ö2GµÄlv,֮ǰ´ÅÅÌʹÓÃÁËÎļþϵͳ´È°®ÓÐÈçϾ¯¸æ¡£ÊäÈëy¼´¿É¡£    
WARNING: linux_raid_member signature detected on /dev/vg_test_01/lv_test_01 at offset 4096. Wipe it? [y/n]: y    
  Wiping linux_raid_member signature on /dev/vg_test_01/lv_test_01.    
WARNING: ext4 signature detected on /dev/vg_test_01/lv_test_01 at offset 1080. Wipe it? [y/n]: y    
  Wiping ext4 signature on /dev/vg_test_01/lv_test_01.    
  Logical volume "lv_test_01" created.
¸´ÖÆ´úÂë

lvµÄÒƳý

[root@centos7 ~]$ lvremove  /dev/vg_test_01/lv_test_01     
# Õâ¸öÒƳýÎÒÃÇÉÏÃæ´´½¨lv_test_01Õâ¸öÂß¼­¾í£¬ ÏÂÃæÌáʾÕâ¸öÊǻµÄÂß¼­¾í£¬ÊäÈëy¾Í¿ÉÒÔÁË Do you really want to remove active logical volume vg_test_01
/lv_test_01? [y/n]: y Logical volume "lv_test_01" successfully removed

×¢Ò⣺ Èç¹ûÕâ¸ölv±»¹ÒÔØÁË¡£ ÇëÏÈumount

¹ÒÔØÎļþϵͳ

¸´ÖÆ´úÂë
[root@centos7 ~]$ lvcreate -L 2G  -n lv_test_01 vg_test_01                             # ÉÏÃæÎÒÃÇɾ³ýÁËlv,ÕâÀïÐèÒª´´½¨³öÀ´    
  Logical volume "lv_test_01" created.    
[root@centos7 ~]$ mkfs.ext4  /dev/vg_test_01/lv_test_01                                  # ÕâÀïÎÒʹÓÃext4 ÎļþϵͳÁË¡£centos7ĬÈÏʹÓõÄÎļþϵͳÊÇxfs,µ«ÊÇxfs²»Ö§³ÖËõ¼õµÄ    
    
[root@centos7 ~]$ mkdir /mnt/test_01                                                    # ´´½¨¹ÒÔصãĿ¼    
[root@centos7 ~]$ mount /dev/vg_test_01/lv_test_01  /mnt/test_01/                       # ¹ÒÔØÂß¼­¾í
¸´ÖÆ´úÂë
·¢²¼Ê±¼ä:2019/10/28 ÔĶÁ:7625´Î À´Ô´:»¥ÁªÍø
 


¡¡
技术资æ–?uppage=news.asp·ÖÀà
   
  ÐÐÒµÐÂÎÅ
 
  ¹«Ë¾¶¯Ì¬
 
  ¼¼Êõ×ÊÁÏ
 
  µçÄÔάÐÞ
 
  »Ö¸´°¸Àý
 
  SQLÊý¾Ý¿â
 
  ´ÅÅÌÕóÁÐ
 
  ·þÎñÆ÷
 
  ²ÆÎñÈí¼þ
 
  ÍøÂçÎÊÌâ
 
  linux-XFS
 
  Æ»¹ûµçÄÔ&ϵͳ
 
  °²×¿ÏµÍ³Ïà¹Ø
 
  °ì¹«Îļþ
 
  ²Ù×÷ϵͳ
 
  ÈÕ³£Éú»î(ÑĮ̀)
 
  ÍøÕ¾Ïà¹Ø
 
   
¡¡
ÓÑÇéÁ´½Ó
¡¡
¡¡
 
 
 
   
¹«Ë¾µØÖ·£ºÑĮ̀µçÄÔÊг¡#308
µç»°£º0535-6688830 E-Mail:163@163.com
Copyright©2011-2012 ÑĮ̀Èð³Û¿ÆóÓÐÏÞ¹«Ë¾ All Rights Reserved.
³ICP±¸11014811ºÅ-1
ÄúÊDZ¾Õ¾µÚ λ·ÃÎÊÕß