大网数据广告活动
服务器运维问答

Is it possible to resize mounted partition over ssh?

· 52CE 我爱测

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…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-01-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。