How To Mount (Upgrade) Storage on Ubuntu

How To Upgrade Storage In 1Byte's Cloud Server

INTRODUCTION

+ You have probably experienced the confusing situation when you:

1)  Upgrade Cloud Server’ storage (purchase extra storage).

2) Change to another package with higher storage capacity than the original package

+ But you observe that your server’s storage capacity has not increased

→ Reason being, you have not mounted the additional storage that 1Byte provides.

 

+ This tutorial from 1Byte will instruct you on mounting your updated storage into Ubuntu server, applies to both version 20.04 and 18.04.

+ In case you’re not using Ubuntu, but rather Centos or Windows, you may read the corresponding posts here

1)  Ubuntu (You are here)

2) CentOS

3) Windows & Windows Server

+ If you’re utilizing Cloud Hosting, just get in touch with the 1Byte Support team and we’ll take care of everything for you.

+ If you apply this post to a service provided by a provider other than 1Byte, we will not guarantee that everything works as it should

PREREQUISITES

+ A running Ubuntu 18.04 or 20.04 has been upgraded storage

+ Data should be backed up off-server (to another server or to cloud-based internet storage or to your local computer/ laptop), not only on the server you’re now using. Considering how easily it is to accidentally run wrong commands, choose wrong options that leads to delete everything off the hard drive by fiddling with it, it’s best to avoid doing so.

 

ADDITIONAL KNOWLEDGE

– `sda` is the device name for the first SCSI (or SATA) disk attached to your system. Device names for hard drives and other storage devices in Linux follow a standard naming convention, and sda is the device name for the first disk, sdb is the device name for the second disk, and so on. You can consider they are a letter drive C, D, E in Windows system

 

– `vgubuntu-root` or `ubuntu–vg-root` is a logical volume (LV) that is used by Ubuntu to store the root filesystem. It is created from the physical storage devices that are available on your system, and it is used to store the root filesystem, which is the top-level directory that contains all the files and directories on your system.

 

– On Linux, data is typically stored on a `partition` or `logical volume`. A partition is a section of a physical storage device, such as a hard drive, that is used to store data. A logical volume, on the other hand, is a virtual storage device that is created from one or more physical storage devices.

 

upgrade-storage-ubuntu-1byte
Logical Volume Manager In Linux

WORKFLOWS

0) Check storage info of Ubuntu

1) Backup important data (I will skip this step)

2) Create a new Partitions from Physical Hard Drive

3) Extend the Partition to the Volume Group that you want it to resize

4) Add Volume Group into Logical Volume

5) Now you can store Linux system file into Logical Volume

 

STEP-BY-STEP

0. Check Storage Info Of Your Server

+ The `lsblk` command is used to list information about block devices on your system. When you run`lsblk`, it will display a list of all the block devices attached to your system, along with their device names, sizes, and other information

 

				
					#Displays information about the block devices on your Server
lsblk
				
			

+ Let’s check out an example below

1Byte-Recurring-Payment
Before Upgrade Storage: 50GB
upgrade-storage-ubuntu-1byte
After Upgrade Storage: 150GB

+ On the left image side shows an original Cloud Server. If you add the sda1, sda2,…,sda5 together, the total storage is 50GB

+ On the right image side, after upgrading storage, a 100GB increase has been added to the sda (physical hard drive).

+ However in the right image, when we attempt a sum of the sdas (sda1, sda2, sda3, and sda5). The total capacity is still only 50GB. So where is the remaining 100GB being stored?

+ Another method to check storage on Linux is to use the `df -Th command. `df` stands for “disk free,” and it shows information about the file systems on your system, including the file system type, total size, used space, available space, and mount point. The `-T` option tells `df` to display the file system type, and the `-h` option tells it to display sizes in “human-readable” format (e.g., in MB or GB rather than in bytes).

 

				
					#Displays information about the file systems on your Server
df -Th
				
			
Here you can see currently, "ubuntu--vg-root" its maximum capacity is 49GB

→ Through the above 2 commands, we can confirm that 1Byte has provided 100GB more storage for your server, but you still can’t use this storage block because you have not configured your Server to use this Storage, and you haven’t put this Storage to use yet

1. Backup important data on your Server

+ As mentioned in the Intro section, this article will not guide backup data because only you know what data is important, where the data is located to backup, …etc

2. Create A New Partition From The Disk

+ Using ” fdisk ” command is used to create and delete partitions on the hard drive

+ And the hard drive we need to interact is sda. Then run the command below

				
					#Proceed to interact with the sda
fdisk /dev/sda

#Press "m" to check the help menu of fdisk command
				
			
upgrade-storage-ubuntu-1byte
3 commands need to use when using fdisk

+ In general, in this step we will do the following 3 sub-steps
– 2.1: Create a new partition, in my case, this partition will have a capacity of 100GB (the storage that we upgrade) → command ” n ” – add a new partition type

– 2.2: Switch type partition to LVM command ” t “- change a partition type

– 2.3: Save the changes and exit → command ” w ” – write table to disk and exit 

 

				
					#Step 1:
#1.1: Press " n " to create a new parititon
#1.2: Press " p " to choose primary partition type
#1.3: Press " Enter " to get the new first sector. This will prevent overlap with existing sectors
#1.4: Press " Enter " to get the new last sector. This will prevent overlap with existing sectors
				
			
HOW TO UPGRADE STORAGE IN 1BYTE’S CLOUD SERVER? 8

NOTE:

+ It should be take a notice that in my case, my system created partition number 4 → sda4

+ It is possible for your case, the system will create another partition number (not sda4). It could be sda3, sda5, sda6,…etc

				
					#Step 2:
#2.1: Press " t  " to switch partition type
#2.2: Press "partition number". In my case, partition number is 4 (sda4)
#2.3: Press " L  " to list all types of partition
#2.4: Press " 8e " to choose partition type is Linux LVM 
				
			
upgrade-storage-ubuntu-1byte
Remember to choose the correct partition number and partition type is Linux LVM
				
					#Step 3:
#Type " w " to save all the changes and exit
				
			
How To Upgrade Storage In 1Byte's Cloud Server?

3. Extend Volume Group From Newly Created Partition

+ The ” vgs ” command provides volume group information in a configurable form, displaying one line per volume group

				
					#Check logical volumne info
vgs
				
			
Ubuntu 18.04, VG named "ubuntu-vg"
How To Upgrade Storage In 1Byte's Cloud Server?
Ubuntu 20.04, VG named "vgubuntu"

+ Note:You need to pay attention to what this VG name is, each version will have a different name

+Volume group `vgubuntu` now only has 49.50GB, while `ubuntu-vg` has 50.00GB

→ We need to expand this volume more 100GB

 

				
					#3.1 Expand volumne group
#Remember to change your partition number as well as VG name correctly
vgextend vgubuntu /dev/sda4

vgextend ubuntu-vg /dev/sda4

#3.2 Run `vgs` command again to check the result
vgs
				
			
How To Upgrade Storage In 1Byte's Cloud Server?

+Volume group vgubuntu now is extend up to 150GB

3. Extend Logical Volume (LM) To Reach The Maximum Storage Of Volume Group

				
					#Extend vgubuntu-root to /dev/sda4
lvextend /dev/vgubuntu/root /dev/sda4

#and resize it
resize2fs /dev/mapper/vgubuntu-root

#Verify Volume Group again
vgs
				
			
How To Upgrade Storage In 1Byte's Cloud Server?

+ As you can see, we are successfully extend the volume of vgubuntu-root from 48.51GB to 148.50GB

+ Finally, run ” lsblk ” again to check whether the storage of vgubuntu-root reach to 148.50GB or not?

How To Upgrade Storage In 1Byte's Cloud Server?
Bravo!!! The vgubuntu-root now is reach its maximum storage

FINAL WORDS

+ If you read this far, congrats!!!

+ For any questions or concerns during the installation process, don’t hesitate to get in touch with us

MORE REFERENCES

+ To get the latest promotions, events. Please check out this link

+ To get the fastest answer, the FAQ Page is the best place to look for

+ Keep up with 1Byte’s YouTube channel to make it simpler to comprehend

+ As always, 1Byte would bring you fresh content and exclusive deals in the future. STAY TUNED!!!

JOINT OUR GROWING FAMILY

4 Steps To Online Success
4 Steps To Online Success