当前位置:小鱼儿玄机二站 > 小鱼儿玄机二站计算机 > 在线增加磁盘,linux虚构机调治增加磁盘大小

在线增加磁盘,linux虚构机调治增加磁盘大小

文章作者:小鱼儿玄机二站计算机 上传时间:2019-09-08

ESXI4.1 linux虚拟机调整扩充磁盘大小

在线添加磁盘,扩展LVM卷案例

 

 

首先调整磁盘大小为60G  www.2cto.com  

一、添加硬盘,在线扫描出来

注意: 如果虚拟机做快照是无法调节置备大小的,要先删除快照才能调整

首先到虚拟机那里添加一块硬盘,注意必须是SCSI类型的硬盘。

小鱼儿玄机二站 1  

 

点确定后,重启虚拟机OS

扫描硬盘,不用重启操作系统的。

[[email protected] ~] shutdown -r now

echo "- - -" > /sys/class/scsi_host/host0/scan

 

echo "- - -" > /sys/class/scsi_host/host1/scan

[[email protected] ~]fdisk -l

echo "- - -" > /sys/class/scsi_host/host2/scan

 

echo "- - -" > /sys/class/scsi_host/host3/scan

Disk /dev/sda: 64.4 GB, 64424509440 bytes

.......

255 heads, 63 sectors/track, 7832 cylinders

echo "- - -" > /sys/class/scsi_host/hostn/scan

Units = cylinders of 16065 * 512 = 8225280 bytes

 

 

有几个host就扫描几次就可以了!记得修改host的编号。我经过测试发现,无论是虚拟机还是物理机,从远端存储分配一些物理卷给主机,主机上都可以直接用这个命令把新添加的硬盘识别出来。

   Device Boot      Start         End      Blocks   Id  System

然后再运行fdisk -l就能发现新添加的硬盘已经被系统识别了,查看系统日志/var/log/messages,发现对SCSI设备进行了一次重新扫描

小鱼儿论坛高手,/dev/sda1   *           1          13      104391   83  Linux

注意:三个- – -号之间有空隔。

/dev/sda2              14        2610    20860402+  8e  Linux LVM

以下是我添加完硬盘以后执行的过程:

[[email protected] ~]# df -hl

[[email protected] ~]# fdisk -l

文件系统              容量  已用 可用 已用% 挂载点

 

/dev/mapper/VolGroup00-LogVol00

Disk /dev/sda: 107.3 GB, 107374182400 bytes

                       19G   12G  6.4G  64% /

255 heads, 63 sectors/track, 13054 cylinders

/dev/sda1              99M   20M   75M  21% /boot

Units = cylinders of 16065 * 512 = 8225280 bytes

tmpfs                 2.0G     0  2.0G   0% /dev/shm

 

 

   Device Boot      Start         End      Blocks  Id  System

 [[email protected] ~]# fdisk /dev/sda

/dev/sda1   *           1          13      104391  83  Linux

 

/dev/sda2              14       13054  104751832+  8e  Linux LVM

The number of cylinders for this disk is set to 7832.

 

There is nothing wrong with that, but this is larger than 1024,

[[email protected] ~]# echo "- - -" >/sys/class/scsi_host/host0/scan

and could in certain setups cause problems with:

[[email protected] ~]#

1) software that runs at boot time (e.g., old versions of LILO)

 

2) booting and partitioning software from other OSs

[[email protected] ~]# fdisk -l

   (e.g., DOS FDISK, OS/2 FDISK)

 

 

Disk /dev/sda: 107.3 GB, 107374182400 bytes

Command (m for help): n

255 heads, 63 sectors/track, 13054 cylinders

Command action

Units = cylinders of 16065 * 512 = 8225280 bytes

   e   extended

 

   p   primary partition (1-4)

   Device Boot      Start         End      Blocks  Id  System

p

/dev/sda1   *           1          13      104391  83  Linux

Partition number (1-4): 3

/dev/sda2              14       13054  104751832+  8e  Linux LVM

First cylinder (2611-7832, default 2611): 默认回车

 

Using default value 2611

Disk /dev/sdb: 53.6 GB, 53687091200 bytes

Last cylinder or +size or +sizeM or +sizeK (2611-7832, default 7832):默认回车

255 heads, 63 sectors/track, 6527 cylinders

Using default value 7832

Units = cylinders of 16065 * 512 = 8225280 bytes

 

 

Command (m for help): t

Disk /dev/sdb doesn't contain a valid partition table

Partition number (1-4): 3

 

Hex code (type L to list codes): 8e

二、添加硬盘到原有分区

Changed system type of partition 3 to 8e (Linux LVM)

在RedHat 使用中,我们经常会碰到硬盘空间用完的问题。今天也是因为服务器硬盘空间用完,才用到这个增加硬盘,并加入LVM现有空间的操作。

 

 

Command (m for help): p

详细内容见内文。

 

 

Disk /dev/sda: 64.4 GB, 64424509440 bytes

1.收集相关数据

255 heads, 63 sectors/track, 7832 cylinders

执行如下命令:

Units = cylinders of 16065 * 512 = 8225280 bytes

 

 

 

   Device Boot      Start         End      Blocks   Id  System

[[email protected] ~]#vgs

/dev/sda1   *           1          13      104391   83  Linux

 /dev/hdc: open failed: No medium found

/dev/sda2              14        2610    20860402+  8e  Linux LVM

 VG         #PV #LV #SN Attr   VSize VFree

/dev/sda3            2611        7832    41945715   8e  Linux LVM

 VolGroup00   1   2   0wz--n- 99.88G    0

 

 

Command (m for help): w      保存退出

 

The partition table has been altered!

[[email protected] ~]# lvs-a -o +devices

 

 /dev/hdc: open failed: No medium found

Calling ioctl() to re-read partition table.

 LV       VG         Attr  LSize   Origin Snap%  Move Log Copy%  Convert Devices

 

 LogVol00 VolGroup00 -wi-ao 99.12G                                      /dev/sda2(0)

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.

 LogVol01 VolGroup00 -wi-ao 768.00M                                      /dev/sda2(3172)

The kernel still uses the old table.

 

The new table will be used at the next reboot.

2.新加硬盘初始化配置

Syncing disks.

执行如下命令:

 

小鱼儿玄机二站, 

重启虚拟机OS

[[email protected] ~]# fdisk-l

[[email protected] ~]# shutdown -r now

 

[[email protected] ~]fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes

Disk /dev/sda: 64.4 GB, 64424509440 bytes

255 heads, 63 sectors/track, 13054cylinders

255 heads, 63 sectors/track, 7832 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

  Device Boot      Start         End      Blocks  Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda1  *           1          13      104391  83  Linux

/dev/sda2              14        2610    20860402+  8e  Linux LVM

/dev/sda2              14      13054   104751832+  8e Linux LVM

/dev/sda3            2611        7832    41945715   8e  Linux LVM

 

[[email protected] ~]# df -hl

Disk/dev/sdb: 53.6 GB, 53687091200 bytes

文件系统              容量  已用 可用 已用% 挂载点

255heads, 63 sectors/track, 6527 cylinders

/dev/mapper/VolGroup00-LogVol00

Units= cylinders of 16065 * 512 = 8225280 bytes

                       19G   12G  6.4G  64% /

 

/dev/sda1              99M   20M   75M  21% /boot

Disk/dev/sdb doesn't contain a valid partition table

tmpfs                 2.0G     0  2.0G   0% /dev/shm

 

[[email protected] ~]# df -T /dev/sda1

 

文件系统      类型     1K-块        已用     可用 已用% 挂载点

fdisk /dev/sdb

/dev/sda1     ext3      101086     19487     76380  21% /boot

 

 

将硬盘分为一个分区。结果如下:

 格式化/dev/sda3

 

[[email protected] ~]# mkfs.ext3 /dev/sda3   

 [[email protected]~]# fdisk -l

mke2fs 1.39 (29-May-2006)

 

Filesystem label=

Disk /dev/sda: 107.3 GB, 107374182400 bytes

OS type: Linux

255 heads, 63 sectors/track, 13054cylinders

Block size=4096 (log=2)

Units = cylinders of 16065 * 512 = 8225280bytes

Fragment size=4096 (log=2)

 

5248992 inodes, 10486428 blocks

  Device Boot      Start         End      Blocks  Id  System

524321 blocks (5.00%) reserved for the super user

/dev/sda1  *           1          13      104391  83  Linux

First data block=0

/dev/sda2              14       13054  104751832+  8e  Linux LVM

Maximum filesystem blocks=4294967296

 

321 block groups

Disk/dev/sdb: 53.6 GB, 53687091200 bytes

32768 blocks per group, 32768 fragments per group

255heads, 63 sectors/track, 6527 cylinders

16352 inodes per group

Units= cylinders of 16065 * 512 = 8225280 bytes

Superblock backups stored on blocks:

 

         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

   Device Boot      Start         End      Blocks  Id  System

         4096000, 7962624

/dev/sdb1               1        6527   52428096   83  Linux

Writing inode tables: done                           

 

Creating journal (32768 blocks): done

 

Writing superblocks and filesystem accounting information: done

执行如下命令:

This filesystem will be automatically checked every 28 mounts or

[[email protected] ~]# pvcreate /dev/sdb1

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 Physical volume "/dev/sdb1" successfully created

  创建PV

 

[[email protected] ~]# pvcreate /dev/sda3

3.LVM配置命令详解

  Physical volume "/dev/sda3" successfully created

 

  查看PV状态

pvcreate  /dev/sdb1  #将sdb1创建为pv,可以先用pvdisplay查看情况

[[email protected] ~]# pvdisplay

 

  /dev/hdc: open failed: 找不到介质

vgcreatevmax_bkup /dev/emcpowerk  /dev/emcpowerl   #VG创建

  --- Physical volume ---

 

  PV Name               /dev/sda2

vgrenamevmax_bkup vmax_bkupvg   #VG重命名

  VG Name               VolGroup00

 

  PV Size               19.89 GB / not usable 19.49 MB

lvcreate   -L 2.43T   -i 5   -I1024  -n  vmax_bkuplv   vmax_bkupvg  

  Allocatable           yes (but full)

                                               #LV创建,-L指定lv大小,-i指定条带化个数,-I指定条带化尺寸,-n指定lv名称

  PE Size (KByte)       32768

 

  Total PE              636

mkfs-t ext3  /dev/vmax_bkupvg/vmax_bkuplv

  Free PE               0

 

  Allocated PE          636

vgextend  VolGroup00  /dev/sdb1 #将sdb1加入到VolGroup00

  PV UUID               KjvMTJ-8laN-yuwe-N0oA-jtsF-Z0oc-CnzOUX

 

  

lvextend –l  +100%FREE  /dev/VolGroup00/LogVol00  #扩展所有空余空间

  "/dev/sda3" is a new physical volume of "40.00 GB"

 

  --- NEW Physical volume ---

resize2fs  –f /dev/VolGroup00/LogVol00

  PV Name               /dev/sda3

 

  VG Name              

4.配置后的核实

  PV Size               40.00 GB

执行如下命令:

  Allocatable           NO

 

  PE Size (KByte)       0

[[email protected] ~]# vgs

  Total PE              0

 VG         #PV #LV #SN Attr   VSize  VFree

  Free PE               0

  VolGroup00   2  2   0 wz--n- 149.84G    0

  Allocated PE          0

 

  PV UUID               J9yLqC-vpK8-jiwd-5STl-kbRT-BGMg-UB6uPk

 [[email protected] ~]#lvs -a -o +devices

  

 LV       VG         Attr  LSize   Origin Snap%  Move Log Copy%  Convert Devices

[[email protected] ~]# vgdisplay 

 LogVol00 VolGroup00 -wi-ao 149.09G                                      /dev/sda2(0)

  /dev/hdc: open failed: 找不到介质

 LogVol00 VolGroup00 -wi-ao 149.09G                                      /dev/sdb1(0)

  --- Volume group ---

 LogVol01 VolGroup00 -wi-ao 768.00M                                      /dev/sda2(3172)

  VG Name               VolGroup00

 

  System ID            

[[email protected] ~]#df -Th

  Format                lvm2

Filesystem    Type   Size  Used Avail Use% Mounted on

  Metadata Areas        1

/dev/mapper/VolGroup00-LogVol00

  Metadata Sequence No  3

              ext3    145G  97G   41G  71% /

  VG Access             read/write

/dev/sda1     ext3    99M   13M   82M 14% /boot

  VG Status             resizable

tmpfs       tmpfs    3.9G     0 3.9G   0% /dev/shm

  MAX LV                0

 

  Cur LV                2

本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:

  Open LV               2

 

  Max PV                0

 

  Cur PV                1

常见错误:

  Act PV                1

[[email protected] ~]# vgextend volgroup00/dev/sdb1

  VG Size               19.88 GB

 /dev/hdc: open failed: No medium found

  PE Size               32.00 MB

 Volume group "volgroup00" not found

  Total PE              636

[[email protected] ~]# vgextend VolGroup00/dev/sdb1

  Alloc PE / Size       636 / 19.88 GB

  Nophysical volume label read from /dev/sdb1

  Free  PE / Size       0 / 0  

  /dev/sdb1not identified as an existing physical volume

  VG UUID               V6H9Dr-e1mb-7E3v-uEgv-UyYX-da9Q-fD8VVp

 Unable to add physical volume '/dev/sdb1' to volume group 'VolGroup00'.

  

 

  刚创建的PV加入相应的VG

需要先创建pv

[[email protected] ~]# vgextend VolGroup00 /dev/sda3

[[email protected] ~]# pvcreate /dev/sdb1

  /dev/hdc: open failed: 找不到介质

 Physical volume "/dev/sdb1" successfully created

  Volume group "VolGroup00" successfully extended

三.案例(EMC存储上的卷划分LVM详细过程)

 

pvcreate /dev/emcpowerk

[[email protected] ~]# vgdisplay

 Physical volume "/dev/emcpowerk" successfully created

  /dev/hdc: open failed: 找不到介质

bi-bkdb:/ # pvcreate /dev/emcpowerl

  --- Volume group ---

 

  VG Name               VolGroup00

 

  System ID            

 Physical volume "/dev/emcpowerl" successfully created

  Format                lvm2

bi-bkdb:/ #

  Metadata Areas        2

bi-bkdb:/ #

  Metadata Sequence No  4

bi-bkdb:/ # pvcreate /dev/emcpowerm

  VG Access             read/write

 Physical volume "/dev/emcpowerm" successfully created

  VG Status             resizable

bi-bkdb:/ # pvcreate /dev/emcpowern

  MAX LV                0

 Physical volume "/dev/emcpowern" successfully created

  Cur LV                2

bi-bkdb:/ # pvcreate /dev/emcpowero

  Open LV               2

 Physical volume "/dev/emcpowero" successfully created

  Max PV                0

bi-bkdb:/ #

  Cur PV                2

bi-bkdb:/ #

  Act PV                2

bi-bkdb:/ # pvscan

  VG Size               59.88 GB

  PV/dev/emcpowerb   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  PE Size               32.00 MB

  PV/dev/emcpowera   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  Total PE              1916

  PV/dev/emcpowerc   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  Alloc PE / Size       636 / 19.88 GB

  PV/dev/emcpowerf   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  Free  PE / Size       1280 / 40.00 GB

  PV/dev/emcpowere   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  VG UUID               V6H9Dr-e1mb-7E3v-uEgv-UyYX-da9Q-fD8VVp

  PV/dev/emcpowerd   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  

  PV/dev/emcpowerg   VG oraclevg        lvm2 [500.00 GiB / 0    free]

    查看LV状态

  PV/dev/emcpowerj   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  [[email protected] ~]# lvdisplay

  PV/dev/emcpowerh   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  /dev/hdc: open failed: 找不到介质

  PV/dev/emcpoweri   VG oraclevg        lvm2 [500.00 GiB / 0    free]

  --- Logical volume ---

  PV/dev/emcpowerk                      lvm2 [500.00 GiB]

  LV Name                /dev/VolGroup00/LogVol00

  PV/dev/emcpowerl                      lvm2[500.00 GiB]

  VG Name                VolGroup00

  PV/dev/emcpowerm                      lvm2[500.00 GiB]

  LV UUID                sSmNj2-Gw4B-hYE2-9nUw-ybJV-6Yxa-DU4VJt

  PV/dev/emcpowern                      lvm2[500.00 GiB]

  LV Write Access        read/write

  PV/dev/emcpowero                      lvm2[500.00 GiB]

  LV Status              available

 Total: 15 [7.32 TiB] / in use: 10 [4.88 TiB] / in no VG: 5 [2.44 TiB]

  # open                 1

bi-bkdb:/ # vgcreate vmax_bkup/dev/emcpowerk  /dev/emcpowerl/dev/emcpowerm /dev/emcpowern /dev/emcpowero

  LV Size                19.12 GB

 Volume group "vmax_bkup" successfully created

  Current LE             612

bi-bkdb:/ #

  Segments               1

bi-bkdb:/ #

  Allocation             inherit

bi-bkdb:/ # vgscan

  Read ahead sectors     auto

 Reading all physical volumes. This may take a while...

  - currently set to     256

 Found volume group "vmax_bkup" using metadata type lvm2

  Block device           253:0

 Found volume group "oraclevg" using metadata type lvm2

  

 

  --- Logical volume ---

bi-bkdb:/ # vgrename vmax_bkup vmax_bkupvg

  LV Name                /dev/VolGroup00/LogVol01

 Volume group "vmax_bkup" successfully renamed to"vmax_bkupvg"

  VG Name                VolGroup00

 

  LV UUID                LIrXiG-3IiO-LhjI-o3yN-vI5T-Yamm-FxD31j

bi-bkdb:/ # vgs

  LV Write Access        read/write

 VG          #PV #LV #SN Attr   VSize VFree

  LV Status              available

 oraclevg     10   2   0wz--n- 4.88t    0

  # open                 1

 vmax_bkupvg   5   0   0wz--n- 2.44t 2.44t

  LV Size                768.00 MB

bi-bkdb:/ # lvcreate -L  2.43T -i 5 -I 1024  -n vmax_bkuplv vmax_bkupvg

  Current LE             24

 Rounding up size to full physical extent 2.43 TiB

  Segments               1

 Logical volume "vmax_bkuplv" created

  Allocation             inherit

 

  Read ahead sectors     auto

bi-bkdb:/ # mkfs -t ext3 -c/dev/vmax_bkupvg/vmax_bkuplv

  - currently set to     256

 

  Block device           253:1

 

  

四.案例(redhat AS5的LVM在线扩充)

=========================================================

redhat AS5 LVM添加磁盘空间 实例

[[email protected] ~]# lvextend -l +2559 /dev/VolGroup00/   勿回车

 

LogVol00  LogVol01 

[[email protected]_update /]# df -h

注意!不知道选哪个,通过以下命令获取可以得到

Filesystem           Size  Used Avail Use% Mounted on

[[email protected] ~]# df -hl

/dev/mapper/VolGroup00-LogVol00

文件系统              容量  已用 可用 已用% 挂载点

2.9G 2.4G 396M 86% /

/dev/mapper/VolGroup00-LogVol00

/dev/sda1 99M 11M 83M 12% /boot

                       19G   12G  6.4G  64% /

tmpfs 1014M 0 1014M 0% /dev/shm

/dev/sda1              99M   20M   75M  21% /boot

[[email protected]_update /]# fdisk -l

tmpfs                 2.0G     0  2.0G   0% /dev/shm

Disk /dev/sda: 5368 MB, 5368709120 bytes

=========================================================

255 heads, 63 sectors/track, 652 cylinders

 

Units = cylinders of 16065 * 512 = 8225280 bytes

为/dev/VolGroup00/LogVol00增加容量

Device Boot Start End Blocks Id System

[[email protected] ~]# lvextend -l +2559 /dev/VolGroup00/LogVol00

/dev/sda1 * 1 13 104391 83 Linux

  /dev/hdc: open failed: 找不到介质

/dev/sda2 14 652 5132767+ 8e Linux LVM

  Extending logical volume LogVol00 to 99.09 GB

Disk /dev/sdb: 42.9 GB, 42949672960 bytes

  Insufficient free space: 2559 extents needed, but only 1280 available

255 heads, 63 sectors/track, 5221 cylinders

 

Units = cylinders of 16065 * 512 = 8225280 bytes

[[email protected] ~]# lvextend -l +1280 /dev/VolGroup00/LogVol00

Disk /dev/sdb doesn't contain a valid partition table

  /dev/hdc: open failed: 找不到介质

[[email protected]_update /]# fdisk /dev/sdb

  Extending logical volume LogVol00 to 59.12 GB

Device contains neither a valid DOS partition table, nor Sun, SGI or OSFdisklabel

  Logical volume LogVol00 successfully resized

Building a new DOS disklabel. Changes will remain in memory only,

 

until you decide to write them. After that, of course, the previous

用 resize2fs 调整文件系统大小

content won't be recoverable.

[[email protected] ~]# resize2fs /dev/mapper/VolGroup00-LogVol00

 

resize2fs 1.39 (29-May-2006)

The number of cylinders for this disk is set to 5221.

Filesystem at /dev/mapper/VolGroup00-LogVol00 is mounted on /; on-line resizing required

There is nothing wrong with that, but this is larger than 1024,

Performing an on-line resize of /dev/mapper/VolGroup00-LogVol00 to 15499264 (4k) blocks.

and could in certain setups cause problems with:

The filesystem on /dev/mapper/VolGroup00-LogVol00 is now 15499264 blocks long.

1) software that runs at boot time (e.g., old versions of LILO)

[[email protected] ~]# df -hl  

2) booting and partitioning software from other OSs

文件系统              容量  已用 可用 已用% 挂载点

(e.g., DOS FDISK, OS/2 FDISK)

/dev/mapper/VolGroup00-LogVol00

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

                       58G   12G   44G  21%    /

Command (m for help): n

/dev/sda1              99M   20M   75M  21% /boot

Command action

tmpfs                 2.0G     0  2.0G   0% /dev/shm

e extended

 

p primary partition (1-4)

linux虚拟机调整扩充磁盘大小 首先调整磁盘大小为60G www.2cto.com 注意: 如果虚拟机做快照是无法调节置备大小的,要先删除快照才能调整...

p

Partition number (1-4): 1

First cylinder (1-5221, default 1): 

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-5221, default 5221): 

Using default value 5221

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[[email protected]_update /]# fdisk -l

Disk /dev/sda: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 652 5132767+ 8e Linux LVM

Disk /dev/sdb: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sdb1 1 5221 41937651 83 Linux

[[email protected]_update /]# pvcreate /dev/sdb1

Physical volume "/dev/sdb1" successfully created

[[email protected]_update /]# pvdisplay /dev/sdb1

--- NEW Physical volume ---

PV Name /dev/sdb1

VG Name 

PV Size 39.99 GB

Allocatable NO

PE Size (KByte) 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID kW7PHZ-CtMC-0SzR-PNvV-OrZW-2s2d-LFfJ6I

 

[[email protected]_update /]# vgdisplay

--- Volume group ---

VG Name VolGroup00

System ID 

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 4.88 GB

PE Size 32.00 MB

Total PE 156

Alloc PE / Size 156 / 4.88 GB

Free PE / Size 0 / 0 

VG UUID 4Iob4o-byje-ckbV-7dGt-49zm-J27Q-w0NtrU

 

[[email protected]_update /]# vgextend VolGroup00 /dev/sdb1

Volume group "VolGroup00" successfully extended

[[email protected]_update /]# lvextend -L +40G /dev/VolGroup00/

[[email protected]_update /]# lvscan

ACTIVE '/dev/VolGroup00/LogVol00' [2.94 GB] inherit

ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit

[[email protected]_update /]# df -h

Filesystem           Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

2.9G 2.4G 396M 86% /

/dev/sda1 99M 11M 83M 12% /boot

tmpfs 1014M 0 1014M 0% /dev/shm

[[email protected]_update ~]# resize2fs /dev/VolGroup00/LogVol00

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizingrequired

Performing an on-line resize of /dev/VolGroup00/LogVol00 to 10993664 (4k)blocks.

 

The filesystem on /dev/VolGroup00/LogVol00 is now 10993664 blocks long.

[[email protected]_update ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

41G 2.4G 37G 6% /

/dev/sda1 99M 11M 83M 12% /boot

tmpfs 1014M 0 1014M 0% /dev/shm

[[email protected]_update ~]#

 

一、添加硬盘,在线扫描出来 首先到虚拟机那里添加一块硬盘,注意必须是SCSI类型的硬盘。 扫描硬盘,不用...

本文由小鱼儿玄机二站发布于小鱼儿玄机二站计算机,转载请注明出处:在线增加磁盘,linux虚构机调治增加磁盘大小

关键词: