15158846557 在线咨询 在线咨询
15158846557 在线咨询
所在位置: 首页 > 营销资讯 > 网站运营 > 一次不太成功的Esxi虚拟机下群晖NAS硬盘扩容经历

一次不太成功的Esxi虚拟机下群晖NAS硬盘扩容经历

时间:2023-07-13 00:00:01 | 来源:网站运营

时间:2023-07-13 00:00:01 来源:网站运营

一次不太成功的Esxi虚拟机下群晖NAS硬盘扩容经历:

记录我一次不太成功的Esxi虚拟机下群晖NAS硬盘扩容经历

1、先在esxi虚拟机设置中编辑 ,将群晖虚拟机的数据盘的硬盘扩大 由100G 扩大到150G

2、再打开群晖的SSH 服务,默认端口22,使用win10 命令行用SSH登录

3、使用fdisk -l 命令查看硬盘情况

fdisk -lDisk /dev/ram0: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram1: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram2: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram3: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram4: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram5: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram6: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram7: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram8: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram9: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram10: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram11: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram12: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram13: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram14: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/ram15: 640 MiB, 671088640 bytes, 1310720 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/synoboot: 128 MiB, 134217728 bytes, 262144 sectorsDisk model: Virtual SATA Hard DriveUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0xf110ee87Device Boot Start End Sectors Size Id Type/dev/synoboot1 2048 100351 98304 48M 83 Linux/dev/synoboot2 100352 253951 153600 75M 83 Linux/dev/synoboot3 253952 262143 8192 4M 83 LinuxDisk /dev/sdc: 150 GiB, 161061273600 bytes, 314572800 sectorsDisk model: Virtual SATA Hard DriveUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x66e7e9b1Device Boot Start End Sectors Size Id Type/dev/sdc1 2048 4982527 4980480 2.4G fd Linux raid autodetect/dev/sdc2 4982528 9176831 4194304 2G fd Linux raid autodetect/dev/sdc3 9437184 209703455 200266272 95.5G f W95 Ext'd (LBA)/dev/sdc5 9453280 209494623 200041344 95.4G fd Linux raid autodetectDisk /dev/md0: 2.4 GiB, 2549940224 bytes, 4980352 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/zram0: 579 MiB, 607125504 bytes, 148224 sectorsUnits: sectors of 1 * 4096 = 4096 bytesSector size (logical/physical): 4096 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk /dev/md1: 2 GiB, 2147418112 bytes, 4194176 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/md2: 95.4 GiB, 102420119552 bytes, 200039296 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/vg1-syno_vg_reserved_area: 12 MiB, 12582912 bytes, 24576 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/vg1-volume_1: 95 GiB, 102005473280 bytes, 199229440 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/cachedev_0: 95 GiB, 102005473280 bytes, 199229440 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes 可看到 sdc已经扩展到 150G了,

再使用parted /dev/sdc命令,可看到

parted /dev/sdc

GNU Parted 3.2

Using /dev/sdc

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print

print

Model: VMware Virtual SATA Har (scsi)

Disk /dev/sdc: 161GB

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

Partition Table: msdos

Disk Flags:




Number Start End Size Type File system Flags

1 1049kB 2551MB 2550MB primary raid

2 2551MB 4699MB 2147MB primary raid

3 4832MB 107GB 103GB extended lba

5 4840MB 107GB 102GB logical raid

但可看到 最后面还是102GB

(parted)

注意这里是针对 3,而不是5 ,针对5会出错,针对3 是成功





4、将sdc3容量扩展到100%parted /dev/sdc resizepart 3 100%:

执行后可能会提示“you may need to update /etc/fstab" 可以去更新这个,也可先不更新。

这时分区已经扩容成功:




可看到硬盘是扩容了,但群晖里的存储空间 还是100G(91.5G)

而存储空间扩容这里也还是95G

5、通过lsof kill等命令关闭正在使用的 进程 及umount volume

直接umount volume1 不行,因为它正在被使用。要先把使用它的一些进程kill掉

群晖中没有内置lsof , fuser等命令,而有些命令也与标准Linux命令不同,如加了syno前缀。




6、要在群晖中安装lsof,要通过以下步骤:

sudo -i #先以root管理员身份

wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/syno-i686-bootstrap_1.2-7_i686.xsh

chmod +x syno-i686-bootstrap_1.2-7_i686.xsh

sh syno-i686-bootstrap_1.2-7_i686.xsh

ipkg update #更新ipkg

ipkg install lsof #安装lsof命令包

安装完可使用lsof 了。

7、逐个kill进程 再umount /volume1 发现进程马上就在使用volume1了,必须使用下面的连续命令

一次杀掉多个PID: kill -9 25718 25719 25811 25812一次排在后边就行了

kill -9 25718 25719 25811 25812; umount /volume1 就可以了,连续执行,不能分2次命令

8、查看md设备:# cat /proc/mdstat




可以看到总共3个md设备,1是主系统,0是引导,2是数据。估计是。但是2一定是数据。

md2是raid1,由sdc3分区组成。

现在让md2中的sdc3离线,# mdadm /dev/md2 -f /dev/sdc3 (我在此步一直无法成功)

提示:mdadm: set /dev/sdc3 faulty in /dev/md2代表成功了。

这是群晖会说整列已降级运行。

从md2中移除sdc3分区:mdadm /dev/md2 -r /dev/sdc3

提示:mdadm: hot removed /dev/sdc3 from /dev/md2




9、最后再 重新分区及加到Raid

fdisk /dev/sdc

按p打印当前分区信息,一定要记住现在的分区信息,后面要用:(我在第8步就卡住了,以下步骤内容摘自网上网友 robin_lee 的文章内容:原文地址,非我原创)

Command (m for help): p

Disk /dev/sdc: 120 GiB, 128849018880 bytes, 251658240 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: 0xe2700574




Device Boot Start End Sectors Size Id Type

/dev/sdc1 2048 4982527 4980480 2.4G fd Linux raid autodetect

/dev/sdc2 4982528 9176831 4194304 2G fd Linux raid autodetect

/dev/sdc3 9437184 66904063 57466880 27.4G fd Linux raid autodetect




输入:d删除分区,默认删除最后一个。按回车。再输入w回车保存。

然后关闭群晖。将ESXi中的DSM虚拟机的磁盘改为150GB.

开机后,putty连接群晖: sudo -i




现在再运行: fdisk /dev/sdc

打印分区,可以看到只有2个分区。

我们把最后一个分区添加上,输入n回车,询问分区类型,直接回车,默认主分区。

询问起始扇区:输入9437184,就是原来第三分区的起始扇区,默认不是这个,一定记得输入。

回车后结束山区啥的都默认就可以了。

输入w保存分区表。




3. 将这快盘的三个分区挂载到群晖的md0,md1,md2上去。

#mdadm /dev/md0 -a /dev/sdc1

#mdadm /dev/md1 -a /dev/sdc2

#mdadm /dev/md2 -a /dev/sdc3

挂载成功,每个语句都会提示:mdadm: added /dev/sdc3 这样的。

10、最后去到群晖存储管理员,会看到一个提示说,空间可以升级到150GB。

点击管理-》扩充即可,然后会提示数据扩充中,这个时间会比较久。完成了容量就变150GB了。




我在做到第8步时,总是提示设备正在使用或忙 无法操作,分析原因是可能是因为要先停掉群晖所有服务,由于dsm7.0 的命令有变化,早期dsm6.0的命令 syno_poweroff_task 已不再支持

我找到所有官网的文章,找到类似的命令:

/usr/syno/bin/synopkg onoffall stop

所有服务是停止了,但还是无法完成第8步。




有熟悉这个的网友请在评论区给些帮助或建议



关键词:经历,成功,虚拟

74
73
25
news

版权所有© 亿企邦 1997-2025 保留一切法律许可权利。

为了最佳展示效果,本站不支持IE9及以下版本的浏览器,建议您使用谷歌Chrome浏览器。 点击下载Chrome浏览器
关闭