← Back to list

PVE: Resize disk without downtime

Resize disk without downtime

Juxuny Wu · 2025-05-28 06:10 · 0 claps · 2.4 min read
#pve #manager-secrets #devops #linux
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud 🔓 · Open Source

PVE: Resize disk without downtime

Resize disk

  1. Chose a disk

  1. Input the size

Resize File System Online

Check the current size of your file system, it is still only 6.9G.

yuanjie@gpu-24g-s1:~$ df -h 
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           775M  1.3M  774M   1% /run
/dev/sda1       7.8G  6.9G  921M  89% /
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda15      105M  6.1M   99M   6% /boot/efi
tmpfs           775M  4.0K  775M   1% /run/user/1000
shm              64M     0   64M   0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/ce82a78735c723c618246c05fdd227bf4726533bc8fb2afe48b901ded385a966/shm
shm              64M     0   64M   0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/407a7a2a4ec93264bd10f84edf7f7f3dda168e31f91cd2baa8abacb7e387133a/shm
shm              64M     0   64M   0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/3d05e714c762b27a31c52359a0f97fa766705b2b7ebf828e9f3c09c82672660c/shm
shm              64M     0   64M   0% /var/snap/microk8s/common/run/containerd/io.containerd.grpc.v1.cri/sandboxes/f66a7474d642b87f18d52daa55c1745f4e2fa3280d9f75d2c30ec38df055415a/shm

Use parted to fix the partition,

parted is a disk partitioning tool used in Linux and other Unix-like operating systems. It allows you to create, resize, delete, and manage partitions on hard drives, SSDs, and other storage devices.

sudo parted /dev/sda

then,

GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

Type help would tell you all available command, all available commands are here:

  align-check TYPE N                       check partition N for TYPE(min|opt) alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found partitions, or a particular partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  resizepart NUMBER END                    resize partition NUMBER
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version

Now, execute print command,

(parted) print                                                            
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 1048576000 blocks) or continue with the current setting? 
Fix/Ignore?

Fix the partition, type Fix,

(parted) print                                                            
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 1048576000 blocks) or continue with the current setting? 
Fix/Ignore? Fix                                                           
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 546GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
14      1049kB  5243kB  4194kB                     bios_grub
15      5243kB  116MB   111MB   fat32              boot, esp
 1      116MB   8804MB  8687MB  ext4

Then, executeresizepart 1 100% to use all space and quit to exit the parted tool.

(parted) resizepart 1 100%
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? Yes                                                               
(parted) quit 

Finally, reisze the file system

yuanjie@gpu-24g-s1:~$ sudo resize2fs /dev/sda1
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 64
The filesystem on /dev/sda1 is now 133192955 (4k) blocks long.

Now, you can use df -h to checkout the size of the disk. The size of /dev/sda1 has been changed.


메타데이터
post_id
d9cc41bb54c8
slug
pve-resize-disk-without-downtime-d9cc41bb54c8
url
https://medium.com/@juxuny/pve-resize-disk-without-downtime-d9cc41bb54c8
canonical_url
https://medium.com/@juxuny/pve-resize-disk-without-downtime-d9cc41bb54c8
author_url
https://medium.com/@juxuny
status
ok
fetched_at
2026-06-26 21:52:29