Chinaunix首页 | 论坛 | 博客
  • 博客访问: 231283
  • 博文数量: 59
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 592
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-01 12:51
个人简介

你们都是我的客户,所以,我对你们是透明的

文章分类

全部博文(59)

文章存档

2016年(29)

2015年(30)

分类: LINUX

2016-01-28 10:45:02

/目录不够了,加块磁盘扩容(vbox虚拟机)

rhel6.4
[root@a ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.4 (Santiago)
Kernel \r on an \m

根分区只有3g了
[root@a ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_a-LogVol01
                       15G   11G  3.1G  78% /
tmpfs                 372M   72K  372M   1% /dev/shm
/dev/sda1              97M   29M   64M  31% /boot

关服务器,然后添加磁盘,这里显示是/dev/sdd  10g,/dev/sdc也是新盘
[root@a ~]# fdisk -l
Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 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: 0x000470fd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              13        2089    16673792   8e  Linux LVM

Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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: 0x289a11e4

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         652     5237158+  83  Linux

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 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/sdd: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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/vg_a-LogVol01: 15.5 GB, 15497953280 bytes
255 heads, 63 sectors/track, 1884 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/vg_a-LogVol00: 1572 MB, 1572864000 bytes
255 heads, 63 sectors/track, 191 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
[root@a ~]#

看看vg
[root@a ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  vg_a   1   2   0 wz--n- 15.90g    0

 一、先扩vg,然后扩lv,然后resize2fs
[root@a ~]# vgextend vg_a /dev/sdd
  No physical volume label read from /dev/sdd
  Physical volume "/dev/sdd" successfully created
  Volume group "vg_a" successfully extended

看看有vfree的空间了
[root@a ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  vg_a   2   2   0 wz--n- 25.89g 10.00g

二、扩lv

[root@a ~]# lvs
  LV       VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  LogVol00 vg_a -wi-ao---  1.46g              --------------------------这个是swap                              
  LogVol01 vg_a -wi-ao--- 14.43g       ----------------------就是这个lv   
 

lvresize这个命令,我试了很多遍才弄好     主要是-L后面的这个大小                        
[root@a ~]# lvresize /dev/vg_a/LogVol01 -L 25.89g
  Rounding size to boundary between physical extents: 25.89 GiB
  Extending logical volume LogVol01 to 25.89 GiB
  Insufficient free space: 2933 extents needed, but only 2559 available
[root@a ~]# lvresize /dev/vg_a/LogVol01 -L 25g   
  Extending logical volume LogVol01 to 25.00 GiB
  Insufficient free space: 2705 extents needed, but only 2559 available
[root@a ~]# lvresize /dev/vg_a/LogVol01 -L 20g
  Extending logical volume LogVol01 to 20.00 GiB
  Logical volume LogVol01 successfully resized
[root@a ~]# lvs
  LV       VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  LogVol00 vg_a -wi-ao---  1.46g                                             
  LogVol01 vg_a -wi-ao--- 20.00g                                             
[root@a ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  vg_a   2   2   0 wz--n- 25.89g 4.43g

[root@a ~]# lvresize /dev/vg_a/LogVol01 -L 24g
  Extending logical volume LogVol01 to 24.00 GiB
  Logical volume LogVol01 successfully resized
[root@a ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree  
  vg_a   2   2   0 wz--n- 25.89g 440.00m

[root@a ~]# lvresize /dev/vg_a/LogVol01 -L 24.4g
  Rounding size to boundary between physical extents: 24.40 GiB
  Extending logical volume LogVol01 to 24.40 GiB
  Logical volume LogVol01 successfully resized
[root@a ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  vg_a   2   2   0 wz--n- 25.89g 28.00m
[root@a ~]# lvresize /dev/vg_a/LogVol01 -L 24.428g
  Rounding size to boundary between physical extents: 24.43 GiB
  Extending logical volume LogVol01 to 24.43 GiB
  Logical volume LogVol01 successfully resized
[root@a ~]# vgs
  VG   #PV #LV #SN Attr   VSize  VFree
  vg_a   2   2   0 wz--n- 25.89g   0(完了)
[root@a ~]#

df -h 看看
[root@a ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_a-LogVol01
                       15G   11G  3.1G  78% /
tmpfs                 372M   72K  372M   1% /dev/shm
/dev/sda1              97M   29M   64M  31% /boot

三、最后一步resize2fs
[root@a ~]# resize2fs /dev/vg_a/LogVol01
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_a/LogVol01 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_a/LogVol01 to 6404096 (4k) blocks.
The filesystem on /dev/vg_a/LogVol01 is now 6404096 blocks long.

[root@a ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_a-LogVol01
                       25G   11G   13G  46% /
tmpfs                 372M   72K  372M   1% /dev/shm
/dev/sda1              97M   29M   64M  31% /boot
[root@a ~]#
over!
20160128

阅读(2768) | 评论(0) | 转发(0) |
0

上一篇:datefile(2)

下一篇:工作记录

给主人留下些什么吧!~~