Skip to content

Mount a new drive

How to mount a new drive on a linux system over command line


First, list the physically installed disks

fdisk -l

Next, Pick the disk you want to mount

mkfs.ext4 /dev/<disk path>

Mount the drive

mount /dev/<disk path> /<location to mount>

To auto mount it, edit fstab

Firstly, found out it's UUID

blkid

should look like the below, here we want /dev/xvdb

[stannardb@nextcloud]:~$ blkid
/dev/xvdb: UUID="02ed6055-ccea-40d7-a735-4045a36df5d7" TYPE="ext4"
/dev/xvda2: UUID="0fa95d3f-7231-4b98-94ca-3d407d88f600" TYPE="ext4" PARTUUID="8ecf3453-59dd-4535-94e6-656f66c289f7"
/dev/sr0: UUID="2019-07-16-08-51-27-00" LABEL="XCP-ng Tools" TYPE="iso9660"
sudo nano /etc/fstab

UUID=02ed6055-ccea-40d7-a735-4045a36df5d7 /nextcloud ext4 defaults 0 0

This mounts the disk with the UUID of 02ed6055-ccea-40d7-a735-4045a36df5d7 to /nextcloud as an ext4 drive

Old Method
Device  Mountpoint  fstype  option  dump    fsck
/dev/sdb1   /home/yourname/mydata   ext4    defaults    0   1

Want to make this site better? Open a PR or help fund hosting costs