Perhaps you have purchased physical disks for a server, they will need to be added to the system, configured and set to be available after a reboot.
Regardless of whether its Hard Drive or M2, etc. storage in Linux is seen as a block device with some kind of a UUID. This address method is used here in place of the traditional /dev/sda2, etc, in cases where disks are connected in differing order, for example.
In this quick tutorial, we mount a new hard disk and set it up.
0 . Latest updates and prerequisites.
2026.07.01 – Updated, Ubuntu 22.04 Server.
Check back for updates, if you run into trouble. Leave a comment if the post is missing some detail.
You need sudo or root access to control storage devices.
1 . Connect the storage to the server.
SATA cables, USB cables, eSATA, it does not matter. Ensure the storage device has power and is connected. Some USB devices have LEDs to show they are “talking”, some hard disks you need to feel for the motor force to know its working. To be sure, make a note of the model/serial number before closing the computer case.
In the example below, an 8TB Seagate drive is added to the server.
The drive is connected and can be seen by “fdisk -l”, in this case, the disk is /dev/sdx:
Disk /dev/sdx: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: ST8000VN0022-2EL
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: C40A713E-6255-40C7-8500-93A52BF6BEDB
Device Start End Sectors Size Type
/dev/sdx1 34 32767 32734 16M Microsoft reserved
/dev/sdx2 32768 15627782831 15627750064 7.3T Microsoft basic data
Using fdisk, clean, then create a new partition with default settings (make sure to substitute sdx for your actual disk. In these next steps your will WIPE this disk completely, please bear that in mind:
fdisk /dev/sdxYour output should look like this, follow the steps to WIPE THE DISK COMPLETELY and set it up as if it were newly created:
Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 has been deleted.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition number (1-128, default 1):
First sector (34-15628053134, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15628053134, default 15628053134):
Created a new partition 1 of type 'Linux filesystem' and of size 7.3 TiB.
Partition #1 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: y
The signature will be removed by a write command.
Command (m for help): wr
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.2 . Format the disk as ext4.
Format the partition with ext4, a durable journal based file system. In this case the partition is the only one on /dev/sdx, /dev/sdx1. Be sure to substitute teh disk and volume path before proceding:
mkfs.ext4 /dev/sdx1mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 1953506385 4k blocks and 244191232 inodes
Filesystem UUID: 1ce6678e-0aca-4c05-a62b-f3cdf295723d
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done3 . Mount the disk at startup.
Mount the disk permanently, by finding its UUID, since this is the thing that gets mounted, first:
blkid | grep sdx/dev/sdx1: UUID="1ce6678e-0aca-4c05-a62b-f3cdf295723d" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="986b4e36-f0e4-ff4e-b5bb-48e6f31a99bb"Add a line similar to this to the file /etc/fstab taking care to reference a mount point that exists, in this case /mnt/HDD8TB:
/dev/disk/by-uuid/1ce6678e-0aca-4c05-a62b-f3cdf295723d /mnt/HDD8TB ext4 defaults 0 1 / ext4 defaults 0 1The drive should mount at every start, automatically.
4 . Create a space alert with Discord.
If you followed this post with the setup of discord as an alerting service, create a script that contains these lines and runs periodically:
for i in $(df -h |grep /dev/ | grep -wv tmpfs | awk '{print $6}'); do /opt/discord/discord.sh "$(hostname)" "Space free on $(df -h $i | awk '{print $1,sum=100-$5"%"}' | tail -1)"; done;As you can see a summary alert can be created and set once a week using something like crontab.
5 . Supporting this blog.
This type of content takes a lot of effort to write. Each post is drafted, researched, then tested multiple times, even a simple step or detail might take more than a few hours to go from the idea to a published blog post.
Did you notice there are no adverts on this site?
If you feel I have saved you some time, you can support me by;
- hosting with DigitalOcean, like I do – click here to go to DigitalOcean.
- buying me a beer through PayPal – click here to go to PayPal.
© horsefreeglue.com 2026 Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Gund Wehsling and horsefreeglue.com with appropriate and specific direction to the original content.