Ubuntu Partition


This article is will demonstrate how to partition your hard drive during the Ubuntu Server OS setup to make sure you are using all of your storage and follows best practices guidelines.


This article assumes you have used or have some familiarity with Ubuntu Servers so I won’t go through all the set up.


The impetus for this article:


My computer/VM has 200Gb of Storage


But Ubuntu only shows 96.88 Gb


Why?


In other words, since I know my hardware has my new Ubuntu server that is supposed to have 200 Gb of data why is the “Usage of /:” line, when I login, have significantly less?


The screen below is an example of a login to a fresh new Ubuntu 20.04 machine that is supposed to have 200Gb. But as you can see displays half of that, 96.88Gb.




Where did the other 100GB of storage go?


This might happen to if you select, what I am calling, the default partition by selecting “Use an entire disk” in the partition setup screen.


Research for this Problem

My research comes heavily from this YouTube video: https://www.youtube.com/watch?v=zoQbSfPkjRI. Thank you TechSolutionZ.


Here are the partitions the video uses and the general best practices for each:


There are the partitions that are standard based on my research.

  1. BootFE: This needs 512Mb regardless of the size

  2. Linux Swap: 8Gb (0r 2 x RAM for machine with less than 8Gb)

  3. Root: can take the rest


Virtual machines

Here are the specs on the VMs that I am using in this article:

  • Hard disk 200GB

  • 2 GB Memory

  • Ubuntu 20.04.5 Server


Full disclosure, I am using VMWare virtual machines (VM) on a Dell OptiPlex 7010, 4 CPUs x Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz Server with two hard drives 1) 4TB and 2) 240GB.



Set Up Partition

Step 1

Once you arrive to the partitions menu in your server setup you will have two options

  1. Use an entire disk

  2. Custom storage layout


Select “Custom storage layout”.




Use an entire disk is what I used often because it was easy to do and it seemed to be a set up that worked for me. However, after noticing that some of the storage space was missing I inspected further.


This article heavily leverages this video (https://www.youtube.com/watch?v=zoQbSfPkjRI) and other websites including ChatGPT.



Step 2: Boot FE partition

Courser down to “free space” click right. Select: Add GPT partition.

Size: 512M

Format: Leave unformatted

“create”





Here is what it looks like after you add Boot FE:




Step 3: Linux Swap Partition

Courser down to “free space”. Click right. Select: “Add GPT partition”.

Size: 4096M (2 x 2Gb)

Format: “swap”

“create”



Here is what it looks like after you add Linux Swap:


Step 4: Root partition cap

Courser down to “free space”. Click right. Select: “Add GPT partition”.

Size: <empty>

Format: ext4 (video says ext4 is recommended)

Mount: “/”

“create”



Here is what it looks like after you add Root:



Here is a screenshot I missed. This is after adding the Swap and before the Root. But in case it wasn’t clear you courser down to “free space”. Click right. Then courser down to “Add GPT Partition” and click enter. This will give the menus we see above for adding Boot FE, Swap, and Root.




Rest of set up

Eventually you will reboot and be prompted to login.


Once you login you should see the line “Usage of /:” followed by a number near the size of your hard drive space. Here is what I have now:


Now I login to my new server and I see most of my 200GB accounted for.

Another way to check

One way to list all block devices and their partitions is using “lsblk” command.


lsblck


Here is the output from this command with the blue arrow pointing to the partition with the bulk of the 200Gb that is available to me to use for apps or whatever I want to use it for.




Conclusion

Based on conversations with ChatGPT it seems this 100GB that I was missing was unallocated. Ubuntu allows us to allocate unallocated space. However, when you allocate all the space as I have done here in this article makes it very difficult to do and it seems it would just be better to spin up a different VM.