文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Splitting a Volume Group

Splitting a Volume Group

时间:2009-08-16  来源:nagaregawa

Splitting a Volume Group   Author: Jaylin Zhou   Create PVs:
# pvcreate /dev/sdb[567]
  Physical volume "/dev/sdb5" successfully created
  Physical volume "/dev/sdb6" successfully created
  Physical volume "/dev/sdb7" successfully created
  Create VG:
# vgcreate myvg /dev/sdb[567]
  Volume group "myvg" successfully created
  Create LV:
# # lvcreate -l 50 /dev/myvg -n mylv
  Logical volume "mylv" created
  Create filesystem on LV:
# mkfs.ext3 /dev/myvg/mylv
  Mount LV and Write data on LV   Determining Free Space:
Use "pvscan" command to determine how much free space is currently available in the VG
# pvscan
  PV /dev/sdb5   VG myvg   lvm2 [100.00 MB / 0    free]
  PV /dev/sdb6   VG myvg   lvm2 [100.00 MB / 0    free]
  PV /dev/sdb7   VG myvg   lvm2 [100.00 MB / 100.00 MB free]
  Total: 3 [300.00 MB] / in use: 3 [300.00 MB] / in no VG: 0 [0   ]
  Moving the Data:
Move all the used PE in /dev/sdb5 to /dev/sdb7 with the "pvmove" command
The "pvmove" command can take a long time to execute
# pvmove /dev/sdb5 /dev/sdb7
  /dev/sdb5: Moved: 100.0%
After moving the data, all of the space on /dev/sdb5 is free
# pvscan
  PV /dev/sdb5   VG myvg   lvm2 [100.00 MB / 100.00 MB free]
  PV /dev/sdb6   VG myvg   lvm2 [100.00 MB / 0    free]
  PV /dev/sdb7   VG myvg   lvm2 [100.00 MB / 0    free]
  Total: 3 [300.00 MB] / in use: 3 [300.00 MB] / in no VG: 0 [0   ]
  Splitting the VG:
Before splitting the VG, the LV must be inactive.
If the file system is mounted, it must be unmounted before deactivating the LV.
Deactivate the LV with the "lvchange" command or "pvchange" command
# lvchange -an /dev/myvg/mylv
Split the VG "yourvg" from the VG "myvg" with moving PV "/dev/sdb5" into the new VG "yourvg"
# vgsplit myvg yourvg /dev/sdb5
  New volume group "yourvg" successfully split from "myvg"
Use the "vgs" command to see the attributes of the two VGs
# vgs
  VG     #PV #LV #SN Attr   VSize   VFree 
  myvg     2   1   0 wz--n- 200.00M      0
  yourvg   1   0   0 wz--n- 100.00M 100.00M
  Creating the New LV:
Create the new LV "yourlv"
# lvcreate -l 100%FREE /dev/yourvg -n yourlv
  Logical volume "yourlv" created
Making a File System and Mounting the New LV:
# mkfs.ext3 /dev/yourvg/yourlv
# mount /dev/yourvg/yourlv  /mnt/
  Activating and Mounting the Original LV:
Check the state of the original LV
# lvscan
  inactive          '/dev/myvg/mylv' [200.00 MB] inherit
  ACTIVE            '/dev/yourvg/yourlv' [100.00 MB] inherit
Activate the original LV
# lvchange -ay /dev/myvg/mylv
Check the new state of the original LV
# lvscan
  ACTIVE            '/dev/myvg/mylv' [200.00 MB] inherit
  ACTIVE            '/dev/yourvg/yourlv' [100.00 MB] inherit
# mount /dev/myvg/mylv /mnt/
相关阅读 更多 +
排行榜 更多 +
勇敢的哈克中文版

勇敢的哈克中文版

飞行射击 下载
狙击突袭特种行动手机版

狙击突袭特种行动手机版

飞行射击 下载
射箭小子

射箭小子

飞行射击 下载