Format and Mount Disks
Note on naming convention:
- disks are labelled as
/dev/sdX
where X is some letter a, b c… - partitions on a disk include a number
/dev/sdXn
where n is 1, 2, 3…
You can see all disks and partitions with: $ sudo fdisk -l
Formatting a new disk
First create a partition using fdisk: $ sudo fdisk /dev/sdX
- Add new partition:
n
- as primary:
p
- with number:
1
- use default first & last sectors (to partition the full disk as one)
- and write the changes:
w
Now we can format the partition with ext4: $ sudo mkfs.ext4 /dev/sdXn
Mounting a disk (permanently)
First mount the partition temporarily: $ sudo mount /dev/sdXn /mnt/location
To mount permanently we’ll need to grab the UUID of the partition from $ sudo blkid
and add a line into $ sudo vim /etc/fstab
:
UUID=<ID from blkid> /mnt/location ext4 defaults 0 0