Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

How to Mount a Disk (linux)

Written by: on 30 August 2022 11:44 AM 30 August 2022 11:44 AM

Find steps on How to mount a disk in Linux on VPSBlocks tutorial. An excellent tutorial guide for self learners.

If you have added SATA space to your VPS, the new drive will not be mounted automatically. To add your new SATA hard disk login to SSH.

Note for this example we are going to assume you are going to mount the drive at /backup


Type: fdisk -l
Look for the unused disk that matches the size you ordered (most likely /dev/sdb) - we will assume it is /dev/sdb for this example
fdisk /dev/sdb
n (new partition)
p (primary partition)
1 (partition number)
Press enter and accept the default cylinder values to allocate the entire hard drive
w (write the partition table)

You've now created your partition and need to format the drive:

/sbin/mkfs.ext4 -L /backup /dev/sdb1

mkdir /backup

chmod 000 /backup

mount /dev/sdb1 /backup

We now need to get the unique identifier for the new drive. Type: blkid

Look for the identifier with the label "/backup" and copy the UUID number to your clipboard e.g. 99e236dc-ca2c-4ee3-95cc-cf3e49e792cc

Now you need to tell the operating system that the drive with that UUID should be mounted at boot to /backup. Type:
pico /etc/fstab

Replace the line below with your UUID and then copy and paste it into the bottom of the file:
UUID=99e236dc-ca2c-4ee3-95cc-cf3e49e792cc /backup ext4 defaults,nofail 0 0

To save press: Ctrl O
Ctrl X

You can now access your SATA drive at the mount point you specified.

(1 vote(s))
Helpful
Not helpful