Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] Increase partition size in a virtual disk image

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
dangeli
Posts: 3
Joined: 2023-06-02 15:26

[Software] Increase partition size in a virtual disk image

#1 Post by dangeli »

Hi.
I had created a VM in Virtualbox running Debian 7 wheezy with a VoIP telephony application, and 10 GB disk in a single partition.
I exported that VM from Virtualbox to VMWare and assign to it 200 GB of hard disk, however, the sda1 partition still shows 10GB
Is there a way to increase the disk size to 200 GB since it has only one partition?

Filesystem Size Used Avail Use% Mounted on
rootfs 9.4G 7.4G 1.6G 83% /
udev 10M 0 10M 0% /dev
tmpfs 801M 212K 801M 1% /run
/dev/disk/by-uuid/9aaef28b-66fa-4dbc-a1f3-9380c1cf4760 9.4G 7.4G 1.6G 83% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.7G 0 1.7G 0% /run/shm

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 9.6G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 466M 0 part [SWAP]

Thanks in advance!
Last edited by dangeli on 2023-06-06 13:17, edited 2 times in total.

Aki
Global Moderator
Global Moderator
Posts: 2816
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 68 times
Been thanked: 382 times

Re: [Software] Increase disk size

#2 Post by Aki »

Hello,

You can use the qemu-nbd command [1] to expose your virtual disk image as a network block device (nbd0 in the example) and to change partitions size using the gparted program. For example:

Code: Select all

$ su -l -c "modprobe nbd"
$ su -l -c "qemu-nbd -c /dev/nbd0 $PWD/virtual_disk_image.qcow2"
$ /sbin/gparted /dev/nbd0
$ su -l -c "qemu-nbd -d /dev/nbd0"
You have to install the qemu-utils package.

---
[1] https://manpages.debian.org/testing/qemu-utils/qemu-nbd.8.en.html
[2] https://manpages.debian.org/testing/gparted-common/gparted.8.en.html
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

dangeli
Posts: 3
Joined: 2023-06-02 15:26

Re: [Software] Increase disk size

#3 Post by dangeli »

Thank you so much Aki.
I will try (maybe this weekend) and then let you know

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: [Software] Increase disk size

#4 Post by ticojohn »

Remember to back up everything you want saved before resizing.
I am not irrational, I'm just quantum probabilistic.

Aki
Global Moderator
Global Moderator
Posts: 2816
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 68 times
Been thanked: 382 times

Re: [Software] Increase disk size

#5 Post by Aki »

Hello,
dangeli wrote: 2023-06-02 17:18 Thank you so much Aki. I will try (maybe this weekend) and then let you know
I'll wait for it.

As @ticojohn suggested, please make a copy of the virtual disk image and use it to test partion resizing.

It would be useful to rename the subject of the first post from "[Software] Increase disk size" to "[Software] Increase partition size in a virtual disk image" to be easily spotted by other viewers.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Random_Troll
Posts: 444
Joined: 2023-02-07 13:35
Been thanked: 105 times

Re: [Software] Increase disk size

#6 Post by Random_Troll »

As an alternative to the QEMU approach the OP could simply run a live Debian version in VirtualBox with the drive attached to the virtual system so that gparted could be used on it directly from the live ISO.
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.

dangeli
Posts: 3
Joined: 2023-06-02 15:26

Re: [Software] Increase partition size in a virtual disk image

#7 Post by dangeli »

Hi,
Thank you for the reply!
I am newby to Linux, and do not quite understand.
You mean that I can create a new VM running debian or Ubuntu, and attach the 10 GB disk running Debian 7 wheezy with a VoIP telephony application, to increase the size using gparted?
In this case, how can I attach the disk to a new VM.

Thanks in advance!

Random_Troll
Posts: 444
Joined: 2023-02-07 13:35
Been thanked: 105 times

Re: [Software] Increase partition size in a virtual disk image

#8 Post by Random_Troll »

I don't use VirtualBox, it's just awful, so I have no idea about the operational specifics, sorry. Perhaps somebody else can help with that.
Jeder nach seinen Fähigkeiten, jedem nach seinen Bedürfnissen.

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1395
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 78 times
Been thanked: 173 times

Re: [Software] Increase partition size in a virtual disk image

#9 Post by steve_v »

Boot the VM from a partitioning livecd iso. gparted live should work nicely, and it has a very easy GUI for moving and resizing.
VirtualBox example: Devices -> Optical Drives -> Choose a disk file -> reboot VM and hit F12 at the "select boot device" prompt to boot from CD.
I don't know anything about VMWare, but presumably it has a comparable feature.

Or as Random_Troll said, make a new VM in VirtualBox (no need to create a hard disk image or install anything), attach your targets virtual disk to it (Settings -> Storage -> select appropriate virtual disk controller -> Add Attachment -> Hard Disk), then proceed as above. Assuming the disk image formats are compatible of course, IIRC they are.

This really has nothing to do with Debian, it's the same generic process you'd use for any guest OS. If you really need a step-by-step how to for attaching storage in [insert VM software of choice], that's more a question for the [insert VM software of choice] people.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Post Reply