How to increase a VB with a encrypted guest?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Leloup78
Posts: 150
Joined: 21. Oct 2017, 15:13

How to increase a VB with a encrypted guest?

Post by Leloup78 »

Bonjour,

I use Linux Mint 19 Mate like Guest and Win7 like host. I chose to encrypt the Hard Disk during the Linux Mint installation. Now I have a problem. I need to increase the size of the VirtualBox (LinuxMint19Mate.vdi) but as I encrypted Linux Mint, I don't know how to do it. :mrgreen:
Do you have any idea?

Regards,

Le loup
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to increase a VB with a encrypted guest?

Post by socratis »

Doesn't the normal way work? Either from the command line or from the GUI, if you're using VirtualBox 6.x.x?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Leloup78
Posts: 150
Joined: 21. Oct 2017, 15:13

Re: How to increase a VB with a encrypted guest?

Post by Leloup78 »

Bonjour Dear Socratis

I don't know if there's a normal way of working. I had fun pushing security until I encrypted the VirtualBox machine and hard drive on Linux. Actually, I'm having fun. The problem was to enlarge the virtual memory size of the HD when it was too small.
Version is 6.0.4 r128413.
Actually, I got my head blown off for nothing. :lol: If I had placed the df -h command in the guest's terminal, I would have realized that my hard disk was only 30% full. :mrgreen: While the storage parameters of the VirtualBox indicated approximately the same values between real and virtual sizes. This must be probably due to encryption.

Regards,

Leloup
Leloup78
Posts: 150
Joined: 21. Oct 2017, 15:13

Re: How to increase a VB with a encrypted guest?

Post by Leloup78 »

How to do?
From Host, the command line is:
C:\Windows\system32>cd C:\Program Files\Oracle\VirtualBox
C:\Program Files\Oracle\VirtualBox>VBoxManage modifyhd H:\Leloup\LinuxMint19Mate.vdi --resize 45000 (the desired size in Mio)
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
(Other ways are possible: fdisk, from the VirtualBox machine manager,...)
From Guest,
Boot Guest called here LinuxMint19Mate on the linuxmint-19-mate-64bit-v2.iso disk.
Keyboard by default is QUERTY so $ setxkbmap fr allows you to come back in AZERTY.
mint@mint:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 1.8G 1 loop /rofs
sda 8:0 0 44G 0 disk
├─sda1 8:1 0 731M 0 part
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 35.4G 0 part
sr0 11:0 1 1.9G 0 rom /cdrom
From Start, type the command gparted. From GParted, extend partitions, sda2 first and sda5 second.
int@mint:~$ sudo apt-get update && sudo apt-get install lvm2 cryptsetup
mint@mint:~$ sudo modprobe dm-crypt
mint@mint:~$ sudo cryptsetup luksOpen /dev/sda5 crypt1
Enter passphrase for /dev/sda5:
mint@mint:~$ sudo vgscan --mknodes
mint@mint:~$ sudo vgchange -ay
mint@mint:~$ sudo cryptsetup resize crypt1
mint@mint:~$ sudo pvresize /dev/mapper/crypt1
mint@mint:~$ sudo pvchange -x y /dev/mapper/crypt1
mint@mint:~$ sudo lvresize -L +7.8G /dev/mint-vg/root
mint@mint:~$ sudo e2fsck -f /dev/mapper/mint--vg-root
mint@mint:~$ sudo resize2fs -p /dev/mapper/mint--vg-root
mint@mint:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 1.8G 1 loop /rofs
sda 8:0 0 44G 0 disk
├─sda1 8:1 0 731M 0 part
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 43.2G 0 part
└─crypt1 253:0 0 43.2G 0 crypt
├─mint--vg-root 253:1 0 39.2G 0 lvm
└─mint--vg-swap_1 253:2 0 4G 0 lvm
sr0 11:0 1 1.9G 0 rom /cdrom
done
https://wiki.archlinux.org/index.php/Re ... VM-on-LUKS
https://help.ubuntu.com/community/Resiz ... Partitions
These two articles gave to me some helps.
Regards,
Leloup
Post Reply