码迷,mamicode.com
首页 > 其他好文 > 详细

动态扩容LVM

时间:2017-09-11 18:05:10      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:动态扩容lvm

[root@localhost ~]# fdisk -l /dev/xvda     #查看磁盘分区情况

Disk /dev/xvda: 536.9 GB, 536870912000 bytes

255 heads, 63 sectors/track, 65270 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: 0x000c6d68

    Device Boot      Start         End      Blocks   Id  System

/dev/xvda1   *           1          64      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/xvda2              64        2611    20458496   8e  Linux LVM

[root@localhost ~]# fdisk /dev/xvda   #创建磁盘新分区

WARNING: DOS-compatible mode is deprecated. It‘s strongly recommended to

         switch off the mode (command ‘c‘) and change display units to

         sectors (command ‘u‘).

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4) p

Partition number (1-4): 3  

First cylinder (2611-65270, default 2611): 

Using default value 2611

Last cylinder, +cylinders or +size{K,M,G} (2611-65270, default 65270): +300G

Command (m for help): p

Disk /dev/xvda: 536.9 GB, 536870912000 bytes

255 heads, 63 sectors/track, 65270 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: 0x000c6d68

    Device Boot      Start         End      Blocks   Id  System

/dev/xvda1   *           1          64      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/xvda2              64        2611    20458496   8e  Linux LVM

/dev/xvda3            2611       41774   314578135   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

[root@localhost ~]# partx -a /dev/xvda  #重新从kernel中读取分区表信息

BLKPG: Device or resource busy

error adding partition 1

BLKPG: Device or resource busy

error adding partition 2

[root@localhost ~]# pvcreate /dev/xvda3  #创建物理卷

  Physical volume "/dev/xvda3" successfully created

[root@localhost ~]# vgextend VolGroup  /dev/xvda3  #将新创建的物理卷加入逻辑卷组

  Volume group "VolGroup" successfully extended

[root@localhost ~]# lvextend -L 310G  /dev/VolGroup/lv_root #扩展逻辑卷大小 +100%FREE全部可用空间

  Extending logical volume lv_root to 310.00 GiB

  Logical volume lv_root successfully resized

[root@localhost ~]# lvs

  LV      VG       Attr      LSize   Pool Origin Data%  Move Log Cpy%Sync Convert

  lv_root VolGroup -wi-ao--- 310.00g                                             

  lv_swap VolGroup -wi-ao---   1.97g        

[root@localhost ~]# 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 = 20

Performing an on-line resize of /dev/VolGroup/lv_root to 81264640 (4k) blocks.

The filesystem on /dev/VolGroup/lv_root is now 81264640 blocks long.

本文出自 “木公子” 博客,请务必保留此出处http://adminls.blog.51cto.com/12264375/1964347

动态扩容LVM

标签:动态扩容lvm

原文地址:http://adminls.blog.51cto.com/12264375/1964347

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!