IncreaseDiskSpaceOnVM_Monitoring_In_Devops

 ​​​​ Monitoring​​ and how to increase disk space in Ubuntu​​ 

What you will Learn:

  • Commands to monitor CPU​​ (uptime, top)

  • Command​​ to monitor memory (free -h)

  • Command to monitor disk usage (df)

  • Increase hard disk space on ubuntu

Commands to monitor CPU

The uptime command will tell us the uptime for our server and the average load​​ on server. Load server gives an​​ indication​​ of​​ how loaded the server is​​ over last 1 minutes, 5 minutes, 15 minutes. So in a system with 1 CPU, if the load average is 1, that means there is exactly 1 process running in that server and that cpu is fully utilized. Our Ubuntu has 1 CPU and hence the server is under-utilized, since the 3 values are less than 1​​ 

If the server has 2 CPUs and if the load avg is greater than 2, it means that server is overloaded.

The ‘top’ command gives information about the top CPU processes plus other details

​​ 

Command​​ to monitor​​ memory

The ‘free -h’ command tells us the details about memory usage

Command​​ to monitor​​ disk usage

‘df -h’ gives details of disk usage. You can see that root partition is 79% used​​ and only 2 giga bytes is left​​ (df is for disk free)​​ 

Increase hard disk space on ubuntu

To increase hard disk space on Ubuntu VM, perform following steps. Search for ‘System Monitor’ app and Hit Enter

Click ‘File Systems’​​ tab, see below

As seen above, right now we have one VM disk of 10 GB.​​ We have used around 7.4 GB and 2.1 GB is left. Close this app.

Now search for ‘Disks’

See above.

Right now we see 11​​ GB​​ hard disk space in total:

Filesystem partition 1​​ (/dev/sda1)​​ has​​ 537​​ MB

Extended partition 2​​ (/dev/sda2)​​ has​​ 10 GB,​​ see below

Filesystem partition 5​​ (/dev/sda5) has​​ 10 GB and is 75.1% full, see below

Close the Disks app.

Let us​​ now​​ expand the disk size from 10 GB to 20 GB

First let us ‘Power off’ the​​ Virtual​​ machine

Once the machine is powered off,​​ right click and click Settings

Go to Storage and under Controller: SATA you would find the machine name, juts make a note of it​​ 

Close the above ‘Settings’ window

Next, File > Virtual Media Manager

Below window comes up

The machine name Ubuntu1.vdi is the same name that we saw earlier on the storage section of ‘Settings’ window. Notice that it currently shows virtual size 10​​ GB

Click properties icon​​ 

See below, attributes section comes up showing current size as 10 GB

Enter 20 GB, see below

​​ 

Click Apply

Notice​​ above​​ that virtual size​​ is now 20​​ GB

Click Close

Power on the machine by clicking ‘Start’

​​ 

Search for the​​ Disks​​ app

See below, we​​ can see free space​​ of​​ 11​​ GB

Now,​​ select extended partition 2

Click ‘Additional partition options’ icon ​​ ​​ 

Click​​ resize​​ 

See above,​​ increase partition size​​ to maximum​​ 

Click Resize

Below window comes up

Authenticate

Notice below that size is now 21 GB

Similarly,​​ select filesystem partition 5

Click ‘Additional partition options’ icon ​​ ​​ 

Click Resize and​​ increase partition size​​ to maximum

​​ 

Click Resize

Once resizing process is complete,​​ close​​ ‘Disks’ app (above​​ window)

Open terminal, execute​​ df​​ -h​​ command, notice below that 12 GB disk space is now available. So we have been able to successfully increase the disk space by additional 10 GB​​ 

Thank you for reading!

Share On

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on tumblr
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Lifetime Membership Club

LIFETIME MEMBERSHIP BIG SALE - ALL LIVE COURES JUST - 7000 RS/ 99 USD
Attend All Live courses in just 7000 rs / $99 - offer ends 31st DEC 2024