How To Mount (Upgrade) Storage On Debian

How To Mount (Upgrade) Storage On Debian

+ 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 Debian 11

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

1)  Ubuntu

2) CentOS

3) Windows & Windows Server

4) Debian 11 (You are here)

+ 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 Debian 11 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

– `debian-vg` is a logical volume (LV) that is used by Debian 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
upgrade-storage-ubuntu-1byte

WORKFLOWS​

0) Check storage info of Debian

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

before-upgrade-debian-storage
Before Upgrade Debian Storage: 16G
after-upgrade-debian-storage
After Upgrade Debian Storage: 250G

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

+ On the left and right image side, after upgrading storage, a 250GB 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 part of sda3 is upgraded without asking 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
before-df-th
Here you can see currently, “debian–vg-root” its maximum capacity is 15GB

→ Through the above 2 commands, we can confirm that 1Byte has provided 250GB 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
fdisk-sda-manual
3 Commands need to use when enter 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 250GB (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 create new partition by default 3. Be careful with the ambiguous partition number
#1.4: Press " Enter " to get the new first sector. This will prevent overlap with existing sectors
#1.5: Press " Enter " to get the new last sector. This will prevent overlap with existing sectors
making-upgrade-sda3

NOTE:

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

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

#Step 2:
#2.1: Press " t  " to switch partition type
#2.2: Press "partition number". In my case, partition number is 3 (sda3)
#2.3: Press " L  " to list all types of partition
#2.4: Press " 8e " to choose partition type is Linux LVM 
sda3-list-8e
Remember to choose the correct partition number and partition type is Linux LVM
#Step 3:
#Type " w " to save all the changes and exit
write-changes-sda3

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
debian-sda3-vgs-before
Debian 11, VG named “debian-vg”

→ We need to expand this volume more 250GB

#3.1 Expand volumne group
#3.3 Run `vgs` command again to check the result
vgs

#Remember to change your partition number as well as VG name correctly
vgextend debian-vg /dev/sda3

#3.3 Run `vgs` command again to check the result
vgs
debian-sda3-vgextend-vg

+Volume group debian-vg now is extend up to 250GB

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

#Extend vgubuntu-root to /dev/sda4
lvextend /dev/debian-vg/root /dev/sda3

#and resize it
xfs_growfs /

#Verify Logical Volume again
lvs
debian-sda3-lvs-before
debian-sda3-lvextend-vg
xfs_growfs-root-debian
debian-lvs-after

+ As you can see, we are successfully extend the volume of debian–vg-root from 14.56GB to 248.56GB

+ Finally, run ” lsblk ” again to check whether the storage of debian–vg-root reach to 248.50GB or not?

after-upgrade-debian-storage
Congrats!, debian–vg-root is now extended to 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!!!