靳闯博客 记录是一种习惯,分享是一种态度
  • 波浪
  • 波浪
  • 波浪
  • 波浪
LINUX下为LVM磁盘增加根分区空间
发表于: | 分类: 技术积累 | 标签: Linux Lvm | 评论:0 | 阅读: 296

LINUX下为LVM磁盘增加硬盘空间

1,为客户机增加一块新的硬盘

2, 重启客户机

3, 用fdisk -l查看整个磁盘空间

#fdisk -l

Disk /dev/sda: 34.4 GB, 34359738368 bytes
255 heads, 63 sectors/track, 4177 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b2d34

 
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        4178    33041408   8e  Linux LVM


Disk /dev/sdb: 214.7 GB, 214748364800 bytes  //新加的盘硬盘
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VolGroup-lv_root: 30.4 GB, 30396121088 bytes
255 heads, 63 sectors/track, 3695 cylinders
Units = cylinders of 16065 * 512 = 8225280 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 3435 MB, 3435134976 bytes
255 heads, 63 sectors/track, 417 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

4, 用pvcreate /dev/sdb将新的硬盘加入物理卷

pvcreate /dev/sdb
Physical volume “/dev/sdb” successfully created

5, 用vgextend VolGroup /dev/sdb将新硬盘加入卷组

vgextend VolGroup /dev/sdb
Volume group “VolGroup” successfully extended

6, 为根分区扩散空间lvextend -L +200G /dev/mapper/VolGroup-lv_root

lvextend -L +180G /dev/mapper/VolGroup-lv_root  //加180G
lvextend -l +100%FREE /dev/VolGroup-lv_root  //加全部
Extending logical volume lv_root to 208.31 GiB
Logical volume lv_root successfully resized

7, 将之应用resize2fs /dev/VolGroup/lv_root

resize2fs /dev/VolGroup/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 14
Performing an on-line resize of /dev/VolGroup/lv_root to 54606848 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 54606848 blocks long.

8, 再用df -hT查看空间,已加入

Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root  206G  5.7G  189G   3% /
tmpfs                         1.9G     0  1.9G   0% /dev/shm
/dev/sda1                     485M   32M  428M   7% /boot


如果这篇文章帮助到了你,我感到十分荣幸!

或许你不想写点什么·但我依旧在这里

icon_mrgreen.pngicon_neutral.pngicon_twisted.pngicon_arrow.pngicon_eek.pngicon_smile.pngicon_confused.pngicon_cool.pngicon_evil.pngicon_biggrin.pngicon_idea.pngicon_redface.pngicon_razz.pngicon_rolleyes.pngicon_wink.pngicon_cry.pngicon_surprised.pngicon_lol.pngicon_mad.pngicon_sad.pngicon_exclaim.pngicon_question.png2018new_aini_org.png2018new_baobao_thumb.png2018new_erha_org.png2018new_kuxiao_thumb.png2018new_yun_thumb.png2018new_hufen_thumb.png2018new_gui_org.png2018new_xiaoerbuyu_org.png2018new_heixian_thumb.png2018new_wabi_thumb.png2018new_tianping_thumb.png
captcha

站点地图 网站地图
豫ICP备17003270号 | Copyright © 2018 💖 靳闯博客
Typecho🍹Sgreen
TOP