3.1 EVE模拟器2.0.3-92: 分区扩展EVE-NG的硬盘容量(50GB扩展为2TB)

3.1 EVE模拟器2.0.3-92: 分区扩展EVE-NG的硬盘容量(50GB扩展为2TB)

1.png

查看硬盘的容量df -Th

dev/mapper/eve--ng--vg-root,所以我们只要把这个LV容量扩大即可

1.png

root@zh-cjh:~# df -Th
Filesystem                   Type      Size  Used Avail Use% Mounted on
udev                         devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                        tmpfs     799M   14M  785M   2% /run
/dev/mapper/eve--ng--vg-root ext4       31G   25G  5.0G  83% /
tmpfs                        tmpfs     3.9G     0  3.9G   0% /dev/shm
tmpfs                        tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs                        tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                    ext2      472M   83M  365M  19% /boot
root@zh-cjh:~#

给EVE-NG硬盘扩大容量,对于EVE-NG来说,相当于加大物理磁盘容量\
注意:无法扩展具有快照的虚拟机中的磁盘,必须删除快照。ESXi上的虚拟机主机,可以使用VMware Workstation连接配置扩展硬盘空间。

EVE-NG系统层面增大VG容量

加电开机EVE-NG,确认硬盘容量为2000G

root@zh-cjh:~# fdisk -l

1.png

Disk /dev/sda: 2 TiB, 2147483648000 bytes, 4194304000 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x2c908394

(硬盘分区情况)

Device     Boot   Start      End  Sectors  Size Id Type

/dev/sda1  *       2048   999423   997376  487M 83 Linux

/dev/sda2       1001470 83884031 82882562 39.5G  5 Extended  (83884031 的sda2的end sector值,该数值 +1即是sda3的start sector)

/dev/sda5       1001472 83884031 82882560 39.5G 8e Linux LVM

Disk /dev/mapper/eve--ng--vg-root: 31.5 GiB, 33843838976 bytes, 66101248 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/eve--ng--vg-swap_1: 8 GiB, 8589934592 bytes, 16777216 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

root@zh-cjh:~#

给硬盘sda分区

 

root@zh-cjh:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.27.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

Command (m for help): n

Partition type

   p   primary (1 primary, 1 extended, 2 free)

   l   logical (numbered from 5)

Select (default p): p

Partition number (3,4, default 3): 3

First sector (999424-4194303999, default 999424): 83884032

#(sda3的start sector,该值是sda2的end sector值 +1)

Last sector, +sectors or +size{K,M,G,T,P} (83884032-4194303999, default 4194303999): 回车

# 由于sda1与sda2中间的一些sector没有使用,所以First sector提示的default是999424

Created a new partition 3 of type 'Linux' and of size 1.9 TiB.

Command (m for help): p

Disk /dev/sda: 2 TiB, 2147483648000 bytes, 4194304000 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x2c908394

Device     Boot    Start        End    Sectors  Size Id Type

/dev/sda1  *        2048     999423     997376  487M 83 Linux

/dev/sda2        1001470   83884031   82882562 39.5G  5 Extended

/dev/sda3       83884032 4194303999 4110419968  1.9T 83 Linux

/dev/sda5        1001472   83884031   82882560 39.5G 8e Linux LVM

Partition table entries are not in disk order.

Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Re-reading the partition table failed.: 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).

root@zh-cjh:~# reboot

(重启,使分区生效)

 

 

将sda3加入到VG中

查看VG的名字

root@zh-cjh:~#vgdisplay

  --- Volume group ---

  VG Name               eve-ng-vg

  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               39.52 GiB

  PE Size               4.00 MiB

  Total PE              10117

  Alloc PE / Size       10117 / 39.52 GiB

  Free  PE / Size       0 / 0  

  VG UUID               gOBLpA-ZKjp-3LZC-U9Hh-4Mz4-EA0K-0jLYX1

root@zh-cjh:~#

 将sda3加入到eve-ng-vg这个VG中

root@zh-cjh:~# vgextend eve-ng-vg /dev/sda3

  Physical volume "/dev/sda3" successfully created

  Volume group "eve-ng-vg" successfully extended

root@zh-cjh:~#

root@zh-cjh:~# vgdisplay

  --- Volume group ---

  VG Name               eve-ng-vg

  System ID            

  Format                lvm2

  Metadata Areas        2

  Metadata Sequence No  4

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                2

  Open LV               2

  Max PV                0

  Cur PV                2

  Act PV                2

  VG Size               1.95 TiB

  PE Size               4.00 MiB

  Total PE              511877

  Alloc PE / Size       10117 / 39.52 GiB

  Free  PE / Size       501760 / 1.91 TiB

  VG UUID               gOBLpA-ZKjp-3LZC-U9Hh-4Mz4-EA0K-0jLYX1

root@zh-cjh:~#

1.png

扩容LV

查看LV路径

root@zh-cjh:~#  lvdisplay

1.png

将剩余容量扩容到/dev/eve-ng-vg/root路径下

root@eve-ng:~# lvextend -l +100%FREE /dev/eve-ng-vg/root

  Size of logical volume eve-ng-vg/root changed from 41.52 GiB (10629 extents) to 1.94 TiB (509829 extents).

  Logical volume root successfully resized.

root@eve-ng:~#

1.png

重新定义文件系统大小

root@zh-cjh:~# resize2fs /dev/eve-ng-vg/root

1.png

完成。

可以看到,硬件空间的使用率为2%,说明空间足够大了。

1.png


模拟器EVE2.0.3-92(列表、list、全)evelist,建议使用EVE2.0.3-112社区版
http://www.zh-cjh.com/wenzhangguilei/1164.html


1、本站资源长期持续更新。
2、本资源基本为原创,部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
3、本站大部分文章的截图来源实验测试环境,请不要在生产环境中随意模仿,以免带来灾难性后果。

转载请保留出处:  www.zh-cjh.com珠海陈坚浩博客 » 3.1 EVE模拟器2.0.3-92: 分区扩展EVE-NG的硬盘容量(50GB扩展为2TB)

作者: cjh


手机扫一扫,手机上查看此文章:

一切源于价值!

其他 模板文件不存在: ./template/plugins/comment/pc/index.htm

未雨绸缪、居安思危!

数据安全、有备无患!

注意操作、数据无价!

一切源于价值!