-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pve 中的 Ubuntu (LVM) 动态扩容 #261
Comments
growpart这个命令就很简单了,这里以扩容 ziyuan@nhan-ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 104M 1 loop /snap/core/16928
loop1 7:1 0 104.2M 1 loop /snap/core/17200
sr0 11:0 1 1024M 0 rom
vda 252:0 0 30G 0 disk
├─vda1 252:1 0 1M 0 part
└─vda2 252:2 0 20G 0 part /
vdb 252:16 0 20G 0 disk 可以看到 vda 容量被我扩容到 30G 了,但是 vda2 还是只有 20G,我们可以利用 growpart 命令快速扩容: ziyuan@nhan-ubuntu:~$ sudo growpart /dev/vda 2
CHANGED: partition=2 start=4096 old: size=41936896 end=41940992 new: size=62910431,end=62914527
ziyuan@nhan-ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 104M 1 loop /snap/core/16928
loop1 7:1 0 104.2M 1 loop /snap/core/17200
sr0 11:0 1 1024M 0 rom
vda 252:0 0 30G 0 disk
├─vda1 252:1 0 1M 0 part
└─vda2 252:2 0 30G 0 part /
vdb 252:16 0 20G 0 disk 分区 vda2 成功变更为 30G 了,然后还需要调整文件系统大小: ziyuan@nhan-ubuntu:~$ sudo resize2fs /dev/vda2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/vda2 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/vda2 is now 7863803 (4k) blocks long. 最终 du 看下文件系统大小: ziyuan@nhan-ubuntu:~$ df -hl
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 395M 3.2M 392M 1% /run
/dev/vda2 30G 17G 12G 60% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 104M 104M 0 100% /snap/core/16928
/dev/loop1 105M 105M 0 100% /snap/core/17200
shm 64M 0 64M 0%
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
大体上就两个步骤:
pve 扩容很简单:

主要讲一下 ubuntu 里的操作:
首先确保系统采用的是 LVM 方式进行管理的:
LVM 非常灵活,所以选择将剩余空间创建为 sda4 然后添加到 ubuntu-lv 中:
再将 sda4 添加到 ubuntu-lv 中:
扩容成功,查看结果:
The text was updated successfully, but these errors were encountered: