How to increase the storage space for my server?

Version: 24.04.4

GNOME (I believe)

So basically i’ve set up my Ubuntu server right, but it only has 60GB allocated to it. In my server i have a 120GB SSD that it boots from and a 1TB HDD and I would like it to use the space on the HDD for storage. Problem being I have no clue how to do that and I would greatly appreciate any help i can get since this is my first time using a server so I feel somewhat out of my depth here.

If you have any questions i’ll try to answer them to the best of my ability.

Hi

could you please show us the output of this command in code format:

lsblk

Also, what do you mean you want to use the HDD for storage? Do you mean additional storage outside your /home directory? Just elaborate a little more on your use case so we understand your end goal.

Sorry I didn’t understand what you were asking for so I just resorted to sending an image of the output, I hope that’s fine.

Also sorry for the confusion, again I am very new to this so its hard to explain. But what i want is for sdb to be where all the files are stored by the server, not ubuntu–vg–ubuntu– lv because its only 60GB. I assume that’s what is being used since when I check on my main PC it says it is 60GB also.

I hope that helps.

Based on your 1sblk output, you have two things to fix. Your system partition is only using half of your SSD, and your 1TB HDD isn’t initialized yet.

1. Reclaiming the “missing” space on your SSD

Your root partition (ubuntu–vg-ubuntu–lv) is only using 58GB, even though your SSD partition (sda3) has ~116GB. You can fix this instantly without losing any data by running these two commands:

sudo lvextend -1 +100%FREE /dev/ubuntu-vg/ubuntu-lv

sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--1v

2. Setting up the 1TB HDD (sdb)

Since your 1TB drive is currently unformatted, you need to prepare it so the server can use it.

Create a partition:

Run sudo fdisk /dev/sdb, type n (new partition), then keep pressing Enter for defaults, and finally type w (write and exit).

Format the drive:

sudo mkfs.ext4 /dev/sdb1

Mount it to a folder:

Create a folder (e.g., /mnt/data) and mount the drive there:

sudo mkdir /mnt/data

sudo mount /dev/sdb1 /mnt/data

Make sure the 1TB drive stays connected after you restart the server, you’ll need to add it to your /etc/fstab file. Let us know if you’d like the steps for that or if you run into any errors!

1 Like

Thank you very much for your reply!

I did as you suggested but in the first part I ran into an error, that being that when i run the first command i get “lvextend: invalid option – ‘1‘ “ I’m not sure if its an error on my part but i ran it a few times and got the same result each time.

Secondly I did everything exactly as you instructed me to do, but sadly the server still displays that I only have 60GB of storage. Not sure if I did something wrong or if there are more steps to this process.

Also yes I would like the steps for that last part you mentioned.

Again thank you for the help, I know its not easy especially with someone as clueless

as me.

@marcelstevano has you on the right track here.

Just a typo in the lvextend command there. Try..

sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

I hope this is the right result? The second command had the same typo as well but luckily I managed to figure that out!

Can you show this command for us:

sudo lvdisplay /dev/mapper/ubuntu--vg-ubuntu--lv

Also, it is easy to show your code output in a code block, like I’ve done here with my snippets. Simply type the back-tick button (```) 3 times, then paste your output right after that.

If your intent is to set up a “server” environment that will organically grow larger, especially to offer services online, then using LVM for your entire system is the recommended approach.

If, on the other hand, your use of the term “server” is intended to reflect that it will be the lynchpin host for a private LAN at home (i.e. family) the LVM approach might be overkill. For that reason, the current (pictured) setup of /dev/sdb1 mounted directly (not logically) at /mnt/data is the better choice. Whether you choose to leave the ROOT partition as a logical volume on top of the underlying /dev/sda3 partition is, at this point, purely a matter of choice on your part.

1 Like

Here you go!

Also I would love to do what you suggested. Problem being that, the server is on another PC, and I don’t know how to interact with it otherwise, so this is my crude solution to that problem. Sorry!

I won’t pretend I understand what half of what you wrote means, but put simply this server is purely for storing files, and all I want is for all the space on it to be utilized for that purpose and for it to be accessible by my main PC. Which is already can be, its just the issue that i can only use a small part of the storage space, which is the problem I came here with.

Sorry I can’t respond to what you said, but that’s because in all honesty I really don’t know how.

Not to “command spam” you here, but these two would also help. The output of these both are very short:

sudo pvs
sudo vgs

Here you go! And don’t worry about ‘command spam’ so long as it helps!

If /dev/sdb1 (/mnt/data) is purely intended for personal, then you can simplify references for yourself.

If you want to, you could create a directory

sudo mkdir /mine

then you can enter the command

sudo umount /dev/sdb1

then update /etc/fstab by replacing the reference to “/mnt/data” by “/mine

then

sudo mount -t ext4 /dev/sdb1 /mine

Following those steps, any full system search will report the simplified path of /mine/… for any file, rather than /mnt/data/…



(ONLY if you want to push your knowledge and understanding beyond what you need to address your originally stated problem, the following is offered for consideration. None of this is required for your original issue.)

If you are interested, you can see my own fstab included in my posting at

If you do look at that, keep in my that

  • I have multiple partitions on my internal drive (root disk)
    (all DB001_F? mounted directly at root)

  • I have multiple partitions on my external backup drive (USB disk)
    (all DB005_F? or DB006_F? mounted under custom “/site”, to avoid conflicts with system auto-mounter)

If you are wondering why that kind of setup,

  • I apply the “divide and conquer” principle to keep partitions to what I call manageable sizes for “backup” and “full restore”,       and

  • I have a backup logic mapping each /DB001_F${partnum} to the corresponding /site/DB005_F${partnum}

If interested, scripts I use for backups are discussed here.

Well I took the steps you listed. I don’t really know what result they were intended to yield but I trust your advice.

As to the link you posted, again, I am clueless. Looking at it I have no idea where to start and to be honest I don’t entirely understand what any of it means. Sorry for the inconvenience.

1 Like

There are 2 things in motion here. Back to @marcelstevano ‘s post, #1 - which I have been addressing with some commands here, only expands your Ubuntu root filesystem to use the full SSD. These commands related to #1, your root install on LVM (SSD), does nothing for your original question which was how to use your Hard Disk for storage. I defer to the excellent advice of @ericmarceau & @marcelstevano #2 above on achieving that. I will however finish up helping you expand your root to use your whole SSD. Here you go for that…

Your volume group is using the full extent of your SSD. The vgs command shows that you have 58G of remaining unallocated space that your logical volume can be extended to use. Try these commands to gain the full access of your SSD for your root OS:

sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
lsblk

This should show availability of full use of your SSD for the OS now. As you install applications or as your /home grows, you will have some breathing room there.

Next, others can help you get that HDD useful for storage.

Yay! It now says i have 120GB of storage on my server. Thank you very much for the help! Hopefully I can also get the HDD issue resolved, but you have been a great help. Thank you!

1 Like

If you enter the command

df -h | grep 'sdb1'

what do you see reported? If you see the mountpoint as “/mine”, then everything is good.

To simplify access to that storage from your Desktop, you could consider doing this

cd 

ln -s /mine ~/Desktop/mine

You will then be able to open the “/mine” repository directly from your Desktop.

So I ran the first command, and yes, /dev/sdb1 is listed as /mine under Mounted on. Which I believe is correct.

I also ran the two other commands but got the error:

ln: failed to create symbolic link '/home/chen/Desktop/mine': No such file or directory

I’m guessing its a mistake on my part but I am not known for my problem solving skills.

Hope this helps.

I don’t see why you would need it, but try this instead:

sudo ln -s /mine ~/Desktop/mine

If that doesn’t work, can you provide the output from

ls -ld ~/Desktop/mine /mine