Jump to content

Mapping a HDD to Supplement Ubuntu SSD Storage

My new VPS has a 20GB SSD at /dev/vda1 and 4TB HDD at /dev/vdb with the default image being installed to the SSD.

I would like to map the HDD to /home/user/torrents to add bulk storage for my seedbox but none of the tutorials I read were really clear how to do so.

 

A lot of tutorials I googled recommended using gparted but this being a remote server I only been interacting with it via SSH.
Likewise I might have been doing something wrong because each time It tried partitioning, mounting, editing /etc/fstab all it did was kill my server until I undid the fstab edits.
Then again, I might have been doing something wrong because I was trying to combine lessons from multiple tutorials without understanding them so I may have been doing something wrong.

 

I am using Ubuntu 22 without GUI. Any help with config appreciated.

Link to comment
Share on other sites

Link to post
Share on other sites

You can just mount the drive at /home/user/torrents if you want. 

 

But what I'd typically do is mount it at something like /mnt/torrentsDrive and then setup your torrent client to use the new path. Most programs should have a options to change the torrent path.

 

What did you change in fstab? It shouldn't kill the whole server if you just add a new drive. If it fails to boot due to a bad entry, add the nofail option so it won't wait the boot on mounting the drive.

Link to comment
Share on other sites

Link to post
Share on other sites

You can use ln command to link a directory to wherever. Sorry I’m currently not able to give you the exact command.

 

https://man7.org/linux/man-pages/man1/ln.1.html

mY sYsTeM iS Not pErfoRmInG aS gOOd As I sAW oN yOuTuBe. WhA t IS a GoOd FaN CuRVe??!!? wHat aRe tEh GoOd OvERclok SeTTinGS FoR My CaRd??  HoW CaN I foRcE my GpU to uSe 1o0%? BuT WiLL i HaVE Bo0tllEnEcKs? RyZEN dOeS NoT peRfORm BetTer wItH HiGhER sPEED RaM!!dId i WiN teH SiLiCON LotTerrYyOu ShoUlD dEsHrOuD uR GPUmy SYstEm iS UNDerPerforMiNg iN WarzONEcan mY Pc Run WiNdOwS 11 ?woUld BaKInG MY GRaPHics card fIX it? MultimETeR TeSTiNG!! aMd'S GpU DrIvErS aRe as goOD aS NviDia's YOU SHoUlD oVERCloCk yOUR ramS To 5000C18

Link to comment
Share on other sites

Link to post
Share on other sites

Oh easy manual mount command is

sudo mount /dev/vdb1 /home/user/torrent

Or modify fstab

 

Oh don't worry for any wrong configuration it will just go emergency session and correct it from there.

 

Try understand the lines bit and set it up correctly.

 

If drive is not partitioned then follow this 

To create a partition in Linux, you can use the `parted` command. 
First, open a terminal and enter `parted /dev/sda` (replace `/dev/sda` with the device name of your hard drive). 
Then, use the `mkpart` command to create a new partition. 
For example, to create a 500MB partition starting from the beginning of the disk, you can enter `mkpart primary ext4 1MiB 500MiB`.

Thanks chatgpt 

 

Usually you need format drive to be actually be able to mount it.

 

Usually by

sudo mkfs.ext4 /dev/vdb1

 

I'm jank tinkerer if it works then it works.

Regardless of compatibility 🐧🖖

Link to comment
Share on other sites

Link to post
Share on other sites

On 5/22/2024 at 6:41 AM, Ariolander said:

A lot of tutorials I googled recommended using gparted

If you only want one partition there is no need to partition it at all, you can "install" the filesystem directly to the whole disk with mkfs.ext4 /dev/vdb.

If you do want to partition it fdisk is easier to use than parted, your session would look like this:

fdisk /dev/vdb

Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0x80cf6341.

Command (m for help): g
Created a new GPT disklabel (GUID: 325459C8-FFFC-4BF4-A818-287F20437035).

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (34-990, default 34): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (34-990, default 989): 

Created a new partition 1 of type 'Linux filesystem' and of size 478 KiB.

Command (m for help): w
The partition table has been altered.
Syncing disks.

The commands there are 'g' to switch it to a GPT disk, 'n' to create a new partition, just 'enter' 3 times to accept the defaults (1, first sector, last sector*), then 'w' to write the changes to disk. You will now have a vdb1 partition in /dev. 

 

You can mount it directly to /home/user/torrents, but that becomes a step you can't really undo without more work later if you want to use it for other things too, so:

  1. Create a unique mount point for /dev/vdb<1>
    mkdir -p /mnt/storage
  2. Mount it manually
    mount /dev/vdb<1> /mnt/storage
  3. Use get it's UUID
    blkid|grep vdb
    /dev/vdb: UUID="2221858b-be73-4aa8-8ec7-6f3ce1302ec6" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0439cf1a-a878-4ff9-b01f-be37dee6cb57"
  4. Formulate your fstab entry
    UUID=2221858b-be73-4aa8-8ec7-6f3ce1302ec6       /mnt/storage                   ext4    noatime              02

    note the removal of the " marks around the UUID from the blkid output line  

  5. Make the torrents directory and give yourself access
    mkdir /mnt/storage/torrents
    chown [username]:users /mnt/storage/torrents
    chmod g+rw /mnt/storage/torrents
  6. Move existing data in to it and remove the old directory
    cp -aux /home/user/torrents/* /mnt/storage/torrents/
    rm -rf /home/user/torrents
  7. Symlink the new storage area to /home/user/torrents
    ln -s /mnt/storage/torrents /home/user/torrents

Then you are done.

If you do mount directly to /home/user/torrents, you'll need to include uid=[username],gid=[username|users] in the mount options so the fstab line would look more like:

UUID=2221858b-be73-4aa8-8ec7-6f3ce1302ec6    /home/user/torrents    ext4    noatime,uid=steve,mode=775,gid=users    02

 

Most of the commands need to be issued with root privilege, so run sudo su before you start and exit once you are done (to drop back to a user shell).

 

EDIT: Because copying UUID's in a shell without GPM or similar is a chore, I often use blkid|grep vdb >>/etc/fstab and clean it up afterwards, so I don't make mistakes.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×