You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:在OpenMediaVault/VirtualBox中扩展主引导分区(已扩容虚拟空间)

Got it, let's work through this together—you've already bumped your VirtualBox disk up to 8GB, now you just need to stretch the main boot/root partition to use that extra space without reinstalling. Let's break this down step by step, since you've already checked GParted, lsblk, and fdisk -l.

First, confirm what you're working with

First, double-check your disk layout to make sure the unallocated 6GB is visible to the OS. Run these commands again to verify:

lsblk
fdisk -l

Look for your main disk (usually /dev/sda on most systems) — it should show a total size of 8GB. Then check your main partition (the one mounted to /, often /dev/sda1 or /dev/sda2) — its size will still be ~2GB, with the remaining space listed as unallocated.

Step 1: Fix the "device busy" issue (if you hit this)

If you tried modifying the partition while the OS was running and got a "device is busy" error, that's normal—you can't resize a partition that's actively mounted (like your root partition). Here's how to get around it:

  • Fire up your VirtualBox VM, but boot from a GParted Live ISO (attach the ISO to the VM's optical drive in VirtualBox settings).
  • Once you're in the GParted live environment, select your disk (top-right dropdown) — you'll see the unallocated space at the end of the disk.
Step 2: Resize the partition (GUI with GParted)

This is the simplest method if you prefer a visual interface:

  • Right-click your main boot/root partition (the one with the mount point /)
  • Select Resize/Move from the menu
  • Drag the right-hand slider all the way to the right to take up all unallocated space
  • Click the Apply button (green checkmark) at the top of the window to commit the changes
  • Once done, reboot the VM back into your normal OS.
Step 3: Resize the partition (command-line alternative)

If you prefer the terminal, use these tools (works for both MBR and GPT partition tables):

  1. First, install the growpart utility (it handles resizing partitions safely):
    • For Debian/Ubuntu-based systems:
      sudo apt update && sudo apt install cloud-guest-utils
      
    • For RHEL/CentOS/Fedora:
      sudo yum install cloud-utils-growpart
      
  2. Resize the partition (replace /dev/sda with your disk, and 1 with your partition number—e.g., /dev/sda1):
    sudo growpart /dev/sda 1
    
  3. Finally, expand the file system to fill the resized partition:
    • If you're using ext4 (most common):
      sudo resize2fs /dev/sda1
      
    • If you're using XFS:
      sudo xfs_growfs /dev/sda1
      
    Note: XFS allows online resizing while the partition is mounted, so you don't need a live CD for this case.
Troubleshooting common errors

If you ran into an error earlier, here's what might be going on:

  • "No space left on device": Double-check that the unallocated space is directly after your main partition (VirtualBox usually adds the extra space to the end of the disk, but if not, you might need to move partitions first—GParted can handle this, but it takes longer).
  • "Invalid partition table": Make sure you're targeting the correct disk/partition (use lsblk to confirm). If you're using MBR, remember you can only have 4 primary partitions—if you hit this limit, you'll need to convert one primary partition to an extended partition first.
  • LVM systems: If your root partition is part of a logical volume, the steps are slightly different:
    1. Resize the physical volume: sudo pvresize /dev/sda2
    2. Expand the logical volume: sudo lvextend -l +100%FREE /dev/mapper/[your-vg-name]-root
    3. Grow the file system: sudo resize2fs /dev/mapper/[your-vg-name]-root or sudo xfs_growfs /dev/mapper/[your-vg-name]-root

内容的提问来源于stack exchange,提问作者Pavel Fedorov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:30:18