Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1749271
  • 博文数量: 152
  • 博客积分: 3730
  • 博客等级: 上尉
  • 技术积分: 3710
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-02 14:36
个人简介

减肥,运动,学习,进步...

文章分类

全部博文(152)

文章存档

2016年(14)

2015年(17)

2014年(16)

2013年(4)

2012年(66)

2011年(35)

分类: 服务器与存储

2015-09-08 21:22:38

LVM被称为逻辑卷管理,逻辑卷的出现解决了单一磁盘分区的存储空间动态添加的问题,同时这种动态扩展的方式能够解决不掉线更新的处理。逻辑卷的基本模型如下图所示:

关于逻辑卷的处理主要包括如下的几个概念:
PV是指实际的物理卷,但每个物理卷由一定数量的PE构成,PE通常为4M大小,因此PV的大小通常都是4M的整数倍。
VG是虚拟卷组,每个VG创建时由一系列的物理PV构成,实际上VG中是由所有PV中的PE构成,也VG也称为是PE池。
LV实际上是在VG之上的实现,LVM实际是从VG(PE池)中取出一定数量的PE构成逻辑卷,每个PE实际上只归属一个LVM。
由以上的分析可知,逻辑卷的实现实际上只是在实际磁盘和逻辑卷之间添加了一个中间层,通过中间层实现对物理资源的软件分配。逻辑卷的大小是可以调整的。但需要注意只是卷调整是无意义的,还要调整文件系统的大小。
     PV1 ... PVn
             |
            VG(实现对PV中PE资源的软件管理)
        /    |     \
 LV0     LV1    LV2
客户端使用LVM过程中并没有PV、PE、VG这些概念,对于客户端而言只有LVM。因此PV、VG、PE是逻辑卷内部的概念。关于逻辑卷的管理还是需要三步处理:
创建物理卷, 采用pvcreate创建,可通过pvdisplay查看pv的信息。
创建虚拟卷组,采用命令vgcreate创建,可通过vgdisplay查看vg的信息。
最后是创建逻辑卷,采用lvcreate创建,可通过lvdisplay查看逻辑卷的信息。

点击(此处)折叠或打开

  1. [root@Gong-Computer ~]# pvcreate /dev/sdd
  2. Physical volume "/dev/sdd" successfully created
  3. [root@Gong-Computer ~]# pvcreate /dev/sde
  4. Physical volume "/dev/sde" successfully created
  5. [root@Gong-Computer ~]# pvscan
  6. PV /dev/sdd lvm2 [8.00 GiB]
  7. PV /dev/sde lvm2 [8.00 GiB]
  8. Total: 2 [16.00 GiB] / in use: 0 [0 ] / in no VG: 2 [16.00 GiB]
  9. [root@Gong-Computer ~]# pvdisplay --没有添加到vg时无pe信息
  10. "/dev/sdd" is a new physical volume of "8.00 GiB"
  11. --- NEW Physical volume ---
  12. PV Name /dev/sdd
  13. VG Name
  14. PV Size 8.00 GiB
  15. Allocatable NO
  16. PE Size 0
  17. Total PE 0
  18. Free PE 0
  19. Allocated PE 0
  20. PV UUID Bxqi5f-aDvN-RaYW-CJQa-2PbH-VvMF-umrTAM
  21. "/dev/sde" is a new physical volume of "8.00 GiB"
  22. --- NEW Physical volume ---
  23. PV Name /dev/sde
  24. VG Name
  25. PV Size 8.00 GiB
  26. Allocatable NO
  27. PE Size 0
  28. Total PE 0
  29. Free PE 0
  30. Allocated PE 0
  31. PV UUID p00Ba0-iWBb-oVhZ-kwiy-yXEc-khNX-sKkazU
  32. [root@Gong-Computer ~]# vgcreate mylvmvg /dev/sdd /dev/sde --创建VG
  33. Volume group "mylvmvg" successfully created
  34. [root@Gong-Computer ~]# vgdisplay ---查看VG
  35. --- Volume group ---
  36. VG Name mylvmvg
  37. System ID
  38. Format lvm2
  39. Metadata Areas 2
  40. Metadata Sequence No 1
  41. VG Access read/write
  42. VG Status resizable
  43. MAX LV 0
  44. Cur LV 0
  45. Open LV 0
  46. Max PV 0
  47. Cur PV 2
  48. Act PV 2
  49. VG Size 15.99 GiB
  50. PE Size 4.00 MiB
  51. Total PE 4094
  52. Alloc PE / Size 0 / 0
  53. Free PE / Size 4094 / 15.99 GiB
  54. VG UUID T11gb0-MYs3-Yvym-4bVz-8ABy-8DlF-H1hS3V
  55. [root@Gong-Computer ~]# pvdisplay
  56. --- Physical volume ---
  57. PV Name /dev/sdd
  58. VG Name mylvmvg
  59. PV Size 8.00 GiB / not usable 4.00 MiB
  60. Allocatable yes
  61. PE Size 4.00 MiB
  62. Total PE 2047 ----添加到VG后,存在PE的信息
  63. Free PE 2047
  64. Allocated PE 0
  65. PV UUID Bxqi5f-aDvN-RaYW-CJQa-2PbH-VvMF-umrTAM
  66. --- Physical volume ---
  67. PV Name /dev/sde
  68. VG Name mylvmvg
  69. PV Size 8.00 GiB / not usable 4.00 MiB
  70. Allocatable yes
  71. PE Size 4.00 MiB
  72. Total PE 2047
  73. Free PE 2047
  74. Allocated PE 0
  75. PV UUID p00Ba0-iWBb-oVhZ-kwiy-yXEc-khNX-sKkazU
  76. [root@Gong-Computer ~]# lvcreate -L 2G mylvmvg ---创建逻辑卷
  77. Logical volume "lvol0" created
  78. [root@Gong-Computer ~]# lvcreate -L 2G mylvmvg
  79. Logical volume "lvol1" created
  80. [root@Gong-Computer ~]# lvcreate -L 2G mylvmvg
  81. Logical volume "lvol2" created
  82. [root@Gong-Computer ~]# lvdisplay
  83. --- Logical volume ---
  84. LV Name /dev/mylvmvg/lvol0
  85. VG Name mylvmvg
  86. LV UUID 5EmUJa-E4QB-OcQ6-uAuE-QXls-0dYQ-1OfZjm
  87. LV Write Access read/write
  88. LV Status available
  89. # open 1
  90. LV Size 2.00 GiB
  91. Current LE 512
  92. Segments 1
  93. Allocation inherit
  94. Read ahead sectors auto
  95. - currently set to 256
  96. Block device 253:0
  97. --- Logical volume ---
  98. LV Name /dev/mylvmvg/lvol1
  99. VG Name mylvmvg
  100. LV UUID ZEC6l3-y6GT-xRVf-8I7T-z7v3-KEgu-6yHsPS
  101. LV Write Access read/write
  102. LV Status available
  103. # open 0
  104. LV Size 2.00 GiB
  105. Current LE 512
  106. Segments 1
  107. Allocation inherit
  108. Read ahead sectors auto
  109. - currently set to 256
  110. Block device 253:1
  111. --- Logical volume ---
  112. LV Name /dev/mylvmvg/lvol2
  113. VG Name mylvmvg
  114. LV UUID xk1AMT-iHEj-TnLB-DLD0-AIoD-BSQa-NXZ7UV
  115. LV Write Access read/write
  116. LV Status available
  117. # open 0
  118. LV Size 2.00 GiB
  119. Current LE 512
  120. Segments 1
  121. Allocation inherit
  122. Read ahead sectors auto
  123. - currently set to 256
  124. Block device 253:2
  125. [root@Gong-Computer ~]# ll /dev/mylvmvg/ --新创建的卷是一个软连接对象
  126. total 0
  127. lrwxrwxrwx 1 root root 7 Sep 7 22:48 lvol0 -> ../dm-0
  128. lrwxrwxrwx 1 root root 7 Sep 7 23:03 lvol1 -> ../dm-1
  129. lrwxrwxrwx 1 root root 7 Sep 7 23:03 lvol2 -> ../dm-2
  130. [root@Gong-Computer ~]# ll /dev/d
  131. [root@Gong-Computer ~]# mkfs.ext3 /dev/mylvmvg/lvol0 ---格式化创建好的逻辑卷,格式化之后可以进行逻辑卷的使用
  132. mke2fs 1.41.12 (17-May-2010)
  133. Filesystem label=
  134. OS type: Linux
  135. Block size=4096 (log=2)
  136. Fragment size=4096 (log=2)
  137. Stride=0 blocks, Stripe width=0 blocks
  138. 131072 inodes, 524288 blocks
  139. 26214 blocks (5.00%) reserved for the super user
  140. First data block=0
  141. Maximum filesystem blocks=536870912
  142. 16 block groups
  143. 32768 blocks per group, 32768 fragments per group
  144. 8192 inodes per group
  145. Superblock backups stored on blocks:
  146. 32768, 98304, 163840, 229376, 294912
  147. Writing inode tables: done
  148. Creating journal (16384 blocks): done
  149. Writing superblocks and filesystem accounting information: done
  150. This filesystem will be automatically checked every 27 mounts or
  151. 180 days, whichever comes first. Use tune2fs -c or -i to override.
  152. [root@Gong-Computer ~]# mount /dev/mylvmvg/lvol0 /mnt/nfs/ ----挂载文件
  153. [root@Gong-Computer ~]# ll /mnt/nfs/
  154. total 16
  155. drwx------ 2 root root 16384 Sep 7 22:48 lost+found
  156. [root@Gong-Computer ~]# lvextend -L +1G /dev/mylvmvg/lvol0 ---扩展逻辑卷大小
  157. Extending logical volume lvol0 to 3.00 GiB
  158. Logical volume lvol0 successfully resized
  159. [root@Gong-Computer ~]# resize2fs -f /dev/mylvmvg/lvol0 ---调整文件系统的大小
  160. resize2fs 1.41.12 (17-May-2010)
  161. Resizing the filesystem on /dev/mylvmvg/lvol0 to 786432 (4k) blocks.
  162. The filesystem on /dev/mylvmvg/lvol0 is now 786432 blocks long.
  163. [root@Gong-Computer ~]# lvextend -L +1G /dev/mylvmvg/lvol0
  164. Extending logical volume lvol0 to 4.00 GiB
  165. Logical volume lvol0 successfully resized
  166. [root@Gong-Computer ~]# resize2fs -f /dev/mylvmvg/lvol0
  167. resize2fs 1.41.12 (17-May-2010)
  168. Filesystem at /dev/mylvmvg/lvol0 is mounted on /mnt/nfs; on-line resizing required
  169. old desc_blocks = 1, new_desc_blocks = 1
  170. Performing an on-line resize of /dev/mylvmvg/lvol0 to 1048576 (4k) blocks.
  171. The filesystem on /dev/mylvmvg/lvol0 is now 1048576 blocks long.
  172. [root@Gong-Computer ~]# df
  173. Filesystem 1K-blocks Used Available Use% Mounted on
  174. /dev/sda1 20158332 2937880 16196452 16% /
  175. tmpfs 177736 272 177464 1% /dev/shm
  176. /dev/sda2 15118728 9544700 4806028 67% /opt
  177. /dev/sda5 14262192 9214364 4323348 69% /usr
  178. /dev/sdb1 2086912 32928 2053984 2% /mnt/sdb1
  179. /dev/sdb2 2064208 3072 1956280 1% /mnt/sdb2
  180. /dev/sdc1 3844848 73244 3576296 3% /mnt/sdc1
  181. /dev/sdc2 1942528 32928 1909600 2% /mnt/sdc2
  182. .host:/ 252926972 119266328 133660644 48% /mnt/hgfs
  183. /dev/mapper/mylvmvg-lvol0
  184. 4128448 69692 3849056 2% /mnt/nfs ---实际的逻辑卷文件
  185. [root@Gong-Computer ~]# vgdisplay
  186. --- Volume group ---
  187. VG Name mylvmvg
  188. System ID
  189. Format lvm2
  190. Metadata Areas 2
  191. Metadata Sequence No 6
  192. VG Access read/write
  193. VG Status resizable
  194. MAX LV 0
  195. Cur LV 3
  196. Open LV 1
  197. Max PV 0
  198. Cur PV 2
  199. Act PV 2
  200. VG Size 15.99 GiB
  201. PE Size 4.00 MiB
  202. Total PE 4094
  203. Alloc PE / Size 2048 / 8.00 GiB
  204. Free PE / Size 2046 / 7.99 GiB
  205. VG UUID T11gb0-MYs3-Yvym-4bVz-8ABy-8DlF-H1hS3V
  206. [root@Gong-Computer ~]#
  207. [root@Gong-Computer ~]#
  208. [root@Gong-Computer ~]# lvextend -L +2G /dev/mylvmvg/lvol0 ---改变了卷的大小
  209. Extending logical volume lvol0 to 6.00 GiB
  210. Logical volume lvol0 successfully resized
  211. [root@Gong-Computer ~]# df ---文件系统的大小未改变
  212. Filesystem 1K-blocks Used Available Use% Mounted on
  213. /dev/sda1 20158332 2937884 16196448 16% /
  214. tmpfs 177736 272 177464 1% /dev/shm
  215. /dev/sda2 15118728 9544700 4806028 67% /opt
  216. /dev/sda5 14262192 9214364 4323348 69% /usr
  217. /dev/sdb1 2086912 32928 2053984 2% /mnt/sdb1
  218. /dev/sdb2 2064208 3072 1956280 1% /mnt/sdb2
  219. /dev/sdc1 3844848 73244 3576296 3% /mnt/sdc1
  220. /dev/sdc2 1942528 32928 1909600 2% /mnt/sdc2
  221. .host:/ 252926972 119266328 133660644 48% /mnt/hgfs
  222. /dev/mapper/mylvmvg-lvol0
  223. 4128448 69692 3849056 2% /mnt/nfs
  224. [root@Gong-Computer ~]# resize2fs -f /dev/mylvmvg/lvol0 ---更改文件系统的大小
  225. resize2fs 1.41.12 (17-May-2010)
  226. Filesystem at /dev/mylvmvg/lvol0 is mounted on /mnt/nfs; on-line resizing required
  227. old desc_blocks = 1, new_desc_blocks = 1
  228. Performing an on-line resize of /dev/mylvmvg/lvol0 to 1572864 (4k) blocks.
  229. The filesystem on /dev/mylvmvg/lvol0 is now 1572864 blocks long.
  230. [root@Gong-Computer ~]# pvcreate /dev/sdf --- 创建新的pv
  231. Physical volume "/dev/sdf" successfully created
  232. [root@Gong-Computer ~]# vgextend mylvmvg /dev/sdf ---扩展vg
  233. Volume group "mylvmvg" successfully extended
  234. [root@Gong-Computer ~]# vgdisplay
  235. --- Volume group ---
  236. VG Name mylvmvg
  237. System ID
  238. Format lvm2
  239. Metadata Areas 3
  240. Metadata Sequence No 8
  241. VG Access read/write
  242. VG Status resizable
  243. MAX LV 0
  244. Cur LV 3
  245. Open LV 1
  246. Max PV 0
  247. Cur PV 3
  248. Act PV 3
  249. VG Size 23.99 GiB
  250. PE Size 4.00 MiB
  251. Total PE 6141
  252. Alloc PE / Size 2560 / 10.00 GiB
  253. Free PE / Size 3581 / 13.99 GiB
  254. VG UUID T11gb0-MYs3-Yvym-4bVz-8ABy-8DlF-H1hS3V
  255. [root@Gong-Computer ~]# lvextend -L +2G /dev/mylvmvg/lvol0
  256. Extending logical volume lvol0 to 8.00 GiB
  257. Logical volume lvol0 successfully resized
  258. [root@Gong-Computer ~]# resize2fs -f /dev/mylvmvg/lvol0
  259. resize2fs 1.41.12 (17-May-2010)
  260. Filesystem at /dev/mylvmvg/lvol0 is mounted on /mnt/nfs; on-line resizing required
  261. old desc_blocks = 1, new_desc_blocks = 1
  262. Performing an on-line resize of /dev/mylvmvg/lvol0 to 2097152 (4k) blocks.
  263. The filesystem on /dev/mylvmvg/lvol0 is now 2097152 blocks long.
  264. [root@Gong-Computer ~]# df
  265. Filesystem 1K-blocks Used Available Use% Mounted on
  266. /dev/sda1 20158332 2937892 16196440 16% /
  267. tmpfs 177736 272 177464 1% /dev/shm
  268. /dev/sda2 15118728 9544700 4806028 67% /opt
  269. /dev/sda5 14262192 9214364 4323348 69% /usr
  270. /dev/sdb1 2086912 32928 2053984 2% /mnt/sdb1
  271. /dev/sdb2 2064208 3072 1956280 1% /mnt/sdb2
  272. /dev/sdc1 3844848 73244 3576296 3% /mnt/sdc1
  273. /dev/sdc2 1942528 32928 1909600 2% /mnt/sdc2
  274. .host:/ 252926972 119274456 133652516 48% /mnt/hgfs
  275. /dev/mapper/mylvmvg-lvol0
  276. 8256952 70200 7767388 1% /mnt/nfs
  277. [root@Gong-Computer ~]#
  278. [root@Gong-Computer ~]# vgdisplay
  279. --- Volume group ---
  280. VG Name mylvmvg
  281. System ID
  282. Format lvm2
  283. Metadata Areas 3
  284. Metadata Sequence No 9
  285. VG Access read/write
  286. VG Status resizable
  287. MAX LV 0
  288. Cur LV 3
  289. Open LV 1
  290. Max PV 0
  291. Cur PV 3
  292. Act PV 3
  293. VG Size 23.99 GiB
  294. PE Size 4.00 MiB
  295. Total PE 6141
  296. Alloc PE / Size 3072 / 12.00 GiB
  297. Free PE / Size 3069 / 11.99 GiB
  298. VG UUID T11gb0-MYs3-Yvym-4bVz-8ABy-8DlF-H1hS3V
  299. [root@Gong-Computer ~]# lvdisplay
  300. --- Logical volume ---
  301. LV Name /dev/mylvmvg/lvol0
  302. VG Name mylvmvg
  303. LV UUID 5EmUJa-E4QB-OcQ6-uAuE-QXls-0dYQ-1OfZjm
  304. LV Write Access read/write
  305. LV Status available
  306. # open 1
  307. LV Size 8.00 GiB
  308. Current LE 2048
  309. Segments 3
  310. Allocation inherit
  311. Read ahead sectors auto
  312. - currently set to 256
  313. Block device 253:0
  314. --- Logical volume ---
  315. LV Name /dev/mylvmvg/lvol1
  316. VG Name mylvmvg
  317. LV UUID ZEC6l3-y6GT-xRVf-8I7T-z7v3-KEgu-6yHsPS
  318. LV Write Access read/write
  319. LV Status available
  320. # open 0
  321. LV Size 2.00 GiB
  322. Current LE 512
  323. Segments 1
  324. Allocation inherit
  325. Read ahead sectors auto
  326. - currently set to 256
  327. Block device 253:1
  328. --- Logical volume ---
  329. LV Name /dev/mylvmvg/lvol2
  330. VG Name mylvmvg
  331. LV UUID xk1AMT-iHEj-TnLB-DLD0-AIoD-BSQa-NXZ7UV
  332. LV Write Access read/write
  333. LV Status available
  334. # open 0
  335. LV Size 2.00 GiB
  336. Current LE 512
  337. Segments 1
  338. Allocation inherit
  339. Read ahead sectors auto
  340. - currently set to 256
  341. Block device 253:2
  342. [root@Gong-Computer ~]# pvdisplay
  343. --- Physical volume ---
  344. PV Name /dev/sdd
  345. VG Name mylvmvg
  346. PV Size 8.00 GiB / not usable 4.00 MiB
  347. Allocatable yes (but full)
  348. PE Size 4.00 MiB
  349. Total PE 2047
  350. Free PE 0
  351. Allocated PE 2047
  352. PV UUID Bxqi5f-aDvN-RaYW-CJQa-2PbH-VvMF-umrTAM
  353. --- Physical volume ---
  354. PV Name /dev/sde
  355. VG Name mylvmvg
  356. PV Size 8.00 GiB / not usable 4.00 MiB
  357. Allocatable yes
  358. PE Size 4.00 MiB
  359. Total PE 2047
  360. Free PE 1022
  361. Allocated PE 1025
  362. PV UUID p00Ba0-iWBb-oVhZ-kwiy-yXEc-khNX-sKkazU
  363. --- Physical volume ---
  364. PV Name /dev/sdf
  365. VG Name mylvmvg
  366. PV Size 8.00 GiB / not usable 4.00 MiB
  367. Allocatable yes
  368. PE Size 4.00 MiB
  369. Total PE 2047
  370. Free PE 2047
  371. Allocated PE 0
  372. PV UUID lh0ZmH-5pta-2k2c-DqyR-r3D5-MLbA-fyfF2j
  373. 通过上述的操作就实现了逻辑卷的管理,实现了文件系统的动态扩展,这是磁盘分区无法完成的任务。
  374. 删除逻辑卷的处理按照相反的操作进行。
  375. [root@Gong-Computer ~]# umount /mnt/nfs/
  376. [root@Gong-Computer ~]# lvremove /dev/mylvmvg/lvol0 --删除逻辑卷
  377. Can't remove open logical volume "lvol0"
  378. [root@Gong-Computer ~]# lvremove /dev/mylvmvg/lvol0
  379. Do you really want to remove active logical volume lvol0? [y/n]: y
  380. Logical volume "lvol0" successfully removed
  381. [root@Gong-Computer ~]#
  382. [root@Gong-Computer ~]# lvremove /dev/mylvmvg/lvol1
  383. Can't remove open logical volume "lvol1"
  384. [root@Gong-Computer ~]# lvremove /dev/mylvmvg/lvol2
  385. Do you really want to remove active logical volume lvol2? [y/n]: y
  386. Logical volume "lvol2" successfully removed
  387. [root@Gong-Computer ~]# vgreduce mylvmvg /dev/sdf ---减少vg中的pv
  388. Removed "/dev/sdf" from volume group "mylvmvg"
  389. [root@Gong-Computer ~]# vgscan
  390. Reading all physical volumes. This may take a while...
  391. Found volume group "mylvmvg" using metadata type lvm2
  392. [root@Gong-Computer ~]# vgdisplay
  393. --- Volume group ---
  394. VG Name mylvmvg
  395. System ID
  396. Format lvm2
  397. Metadata Areas 2
  398. Metadata Sequence No 12
  399. VG Access read/write
  400. VG Status resizable
  401. MAX LV 0
  402. Cur LV 1
  403. Open LV 0
  404. Max PV 0
  405. Cur PV 2
  406. Act PV 2
  407. VG Size 15.99 GiB
  408. PE Size 4.00 MiB
  409. Total PE 4094
  410. Alloc PE / Size 512 / 2.00 GiB
  411. Free PE / Size 3582 / 13.99 GiB
  412. VG UUID T11gb0-MYs3-Yvym-4bVz-8ABy-8DlF-H1hS3V
  413. [root@Gong-Computer ~]# pvremove /dev/sdf --删除pv
  414. Labels on physical volume "/dev/sdf" successfully wiped
  415. [root@Gong-Computer ~]# pvdisplay
  416. --- Physical volume ---
  417. PV Name /dev/sdd
  418. VG Name mylvmvg
  419. PV Size 8.00 GiB / not usable 4.00 MiB
  420. Allocatable yes
  421. PE Size 4.00 MiB
  422. Total PE 2047
  423. Free PE 1535
  424. Allocated PE 512
  425. PV UUID Bxqi5f-aDvN-RaYW-CJQa-2PbH-VvMF-umrTAM
  426. --- Physical volume ---
  427. PV Name /dev/sde
  428. VG Name mylvmvg
  429. PV Size 8.00 GiB / not usable 4.00 MiB
  430. Allocatable yes
  431. PE Size 4.00 MiB
  432. Total PE 2047
  433. Free PE 2047
  434. Allocated PE 0
  435. PV UUID p00Ba0-iWBb-oVhZ-kwiy-yXEc-khNX-sKkazU
  436. [root@Gong-Computer ~]# vgdisplay
  437. --- Volume group ---
  438. VG Name mylvmvg
  439. System ID
  440. Format lvm2
  441. Metadata Areas 2
  442. Metadata Sequence No 12
  443. VG Access read/write
  444. VG Status resizable
  445. MAX LV 0
  446. Cur LV 1
  447. Open LV 0
  448. Max PV 0
  449. Cur PV 2
  450. Act PV 2
  451. VG Size 15.99 GiB
  452. PE Size 4.00 MiB
  453. Total PE 4094
  454. Alloc PE / Size 512 / 2.00 GiB
  455. Free PE / Size 3582 / 13.99 GiB
  456. VG UUID T11gb0-MYs3-Yvym-4bVz-8ABy-8DlF-H1hS3V
  457. [root@Gong-Computer ~]# lvdisplay
  458. --- Logical volume ---
  459. LV Name /dev/mylvmvg/lvol1
  460. VG Name mylvmvg
  461. LV UUID ZEC6l3-y6GT-xRVf-8I7T-z7v3-KEgu-6yHsPS
  462. LV Write Access read/write
  463. LV Status available
  464. # open 0
  465. LV Size 2.00 GiB
  466. Current LE 512
  467. Segments 1
  468. Allocation inherit
  469. Read ahead sectors auto
  470. - currently set to 256
  471. Block device 253:1
  472. [root@Gong-Computer ~]#
  473. [root@Gong-Computer ~]# vgreduce mylvmvg /dev/sde
  474. Removed "/dev/sde" from volume group "mylvmvg"
  475. [root@Gong-Computer ~]#
  476. [root@Gong-Computer ~]# pvremove /dev/sde
  477. Labels on physical volume "/dev/sde" successfully wiped
  478. [root@Gong-Computer ~]# vgremove mylvmvg
  479. Do you really want to remove volume group "mylvmvg" containing 1 logical volumes? [y/n]: y
  480. Do you really want to remove active logical volume lvol1? [y/n]: y
  481. Logical volume "lvol1" successfully removed
  482. Volume group "mylvmvg" successfully removed
  483. [root@Gong-Computer ~]# pvremove /dev/sdd
  484. Labels on physical volume "/dev/sdd" successfully wiped
  485. [root@Gong-Computer ~]#
通过逻辑卷的处理能较好的实现磁盘的动态扩展,相比传统的分区磁盘管理要方便不少。
阅读(2168) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~