问题原文
原帖链接 · Tanel Tammik · CC BY-SA 4.0
Background: I was given SSH access to a Ubuntu 20.04 VPS that has root partition of 5G (sda total 25G). VPS provider says Linux admin can resize the /dev/sda1 partition.
$ sudo fdisk -l && df -h
Disk /dev/sda: 25 GiB, 26843545600 bytes, 52428800 sectors
Disk model: Virtual disk
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: 0xe1f10bb0
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 10483711 10481664 5G 83 Linux
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 394M 788K 393M 1% /run
/dev/sda1 4.9G 3.0G 1.7G 64% /
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
tmpfs 394M 0 394M 0% /run/user/1002
I need to resize /dev/sda1 partition mounted to / over SSH. As far as I know, it is not possible.
Is it impossible, is it possible or has there been some miscommunications with the VPS provider? I am in contact with them through a third party.
社区高分解答
原帖链接 · Michael Hampton · CC BY-SA 4.0
You can use the growpart utility to resize the partition to fill the available space. growpart expects the disk device and partition number as separate arguments. So you can resize the partition /dev/sda1 by: growpart /dev/sda 1. Note that the space is required. After that is done, you can resize the filesystem.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
