Root-Server Tutorial

ROOT-SERVER TUTORIAL

Using local Blockstorage on netcup Linux Server

Learn how to attach an local Blockstorage

Author:

Luca Wunderlich

Last updated:

31/12/2023

Introduction

In this tutorial we will show you how to integrate and use additional hard disks under Linux on a netcup server.

Requirements

The tutorial is aimed at users who already have access to their server via SSH. Please make sure that your user has the required authorizations.

You can execute the following command at the beginning of each SSH session: bash sudo -i

Step 1 - Overview of available hard disks

To get an overview of all recognized hard disks, use the command:

fdisk -l

In our example, we have two hard disks: /dev/sda (the system hard disk) and /dev/vda (an additional 50 GiB hard disk).

Step 2 - Create a partition

Use cfdisk to create a partition on the additional disk:

cfdisk /dev/vdb1

Select "dos" in the selection menu for an MBR partition table. Then create a 50 GiB partition as the primary partition.

Step 3 - Format partition

Exit cfdisk and check that the partition has been created:

fdisk -l

Format the partition (in our example as ext4):

mkfs.ext4 /dev/vdb1

Step 4 - Mount the partition

Create a folder for the hard disk (in our example "lbstorage"):

mkdir /lbstorage

Mount the partition in the folder:

mount /dev/vdb1 /lbstorage

Step 5 - Automatic mounting after reboot

Find the UUID of the partition:

blkid /dev/vdb1

Open the /etc/fstab file and add the UUID:

nano /etc/fstab

Add the line at the end of the file (replace the UUID with the correct one):

UUID=your_uuid_here /lbstorage ext4 defaults 0 0

Save the file.

Conclusion

The additional disk is now ready for use and will automatically be mounted after a reboot.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributor's Certificate of Origin

By making a contribution to this project, I certify that:

  1. The contribution was created in whole or in part by me and I have the right to submit it under the license indicated in the file; or

  2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same license (unless I am permitted to submit under a different license), as indicated in the file; or

  3. The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

  4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the license(s) involved.

Published 31/12/2023 by Luca Wunderlich

Submit your tutorial

Get 60€ netcup vouchers for every published tutorial.