0

Background

I created a server inside Oracle VirtualBox with an HD size of 500GB. The host is Windows 10 Pro x64 2004 19041.572. The guest OS is Ubuntu 18.04 and I encrypted the installation using LUKS(the entire drive, not just the profile).

What I am trying to accomplish

I basically ran out of space... I never thought I could fill 500GB but here we are.

I know that I expand the Oracle VirtualBox .vdi file... this has been exhaustively covered and I have even done this before. But, after I add the extra space at "the end" of the partition, what are my next steps?

Theory

My best guess would be: boot the partition live disc, mount the encrypted storage container, expand the container to the extra space I added (250GB), commit the changes, and reboot.

What actually happened

Expanded vdi file from 500GB to 750GB. I booted from Ubuntu 18 Live Disc. Corrected time difference. Updated the repos. Added the universe repo. Install sudo apt install partitionmanager. Extended the luks container to 750GB. Reboot. df -h still shows 500GB. Reboot to live disc again.

Now my /dev/sda2 extended itself from 500 to 750GB (good). Now when I select the mounted encrypted volume, there are three "partitions": root size 500GB, swap the encrypted swap volume of 980MiB, and unallocated of 250GB. I cannot seem to extend the root to encompass the unallocated space. See photo.

KDE Partition Manager Screeny

HELP

How do I use my unallocated storage?

Additional

Thank you in advanced for your help and suggestions.

1 Answer 1

0

This was quite the journey for me and delightfully, I learned quite a bit from this experience... and hope I don't have to do it again for quite a while.

Steps to extend your encrypted LUKS partition inside a VirtualBox host Ubuntu

  1. Increase .vdi size (Google increase virtualbox hard drive)
  2. Download and boot into Ubuntu 18.04 (or whatever ubuntu version you are on)
  3. Try
  4. I personally had to fix the clock to match what time it actually was
  5. Open terminal
  6. sudo add-apt-repository universe
  7. sudo apt update
  8. sudo apt install partitionmanager
  9. sudo partitionmanager
  10. On left hand side, click on ATA VBOX HARDDISK
  11. Select the encrypted volume, right click, Decrypt, enter your password
  12. Go one level up, select the "extended" volume that holds the encrypted partition
  13. Right click, resize, drag to the very end
  14. Apply your changes
  15. Close KDE Partition Manager
  16. Launch it again sudo partitionmanager
  17. There should be two devices now. If not, decrypt your encrypted partition again, and refresh drive list. It should then show the name of your encrypted volume in the devices list on left hand side.
  18. It should look like that screen shot above
  19. Write down the name of the swap (mine was swap_1) and then right click on your "linuxswap" partition and delete it
  20. Right click on your encrypted root partition and expand it (make sure to leave room at the end for your to-be-created swap space - I did 1024MB)
  21. Apply your changes
  22. Right click on the unallocated/unknown partition and choose "New"
  23. Change the type from ext4 to linuxswap and name it "swap_1" or whatever the name was before you deleted it
  24. Apply your changes
  25. Close KDE Partition Manager
  26. Type exit to close the terminal window
  27. Shutdown the VM
  28. Fire up your VM, log in, and open terminal
  29. Type sudo df -h
  30. You should see that you now have loads of space!

Bonus

Not sure if your newly created swap is encrypted or not? Try these commands:

swapon --summary

If encrypted, you should get something like:

iamdoubz@computer:~$ sudo swapon --summary 
Filename                Type        Size    Used    Priority
/dev/dm-2               partition   1048572 0       -2

Or, you may try these commands:

sudo blkid | grep swap
cat /etc/crypttab

Which should then display:

iamdoubz@computer:~$ sudo blkid | grep swap
/dev/mapper/ubuntu--vg-swap_1: UUID="bla-bla-bla-a386-blablabla" TYPE="swap"
iamdoubz@computer:~$ cat /etc/crypttab
sda5_crypt UUID=bla-bla-blee-blee-blahblah none luks,discard

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .