Mounting a Drive on a Linux System
sda can be sdb or mmlocm or whatever.
lsblk
and fdisk -l
to get info
- If there isn't a numbered /dev/sda1, it isn't partitioned, do step 3.
- Partitioning: fdisk is old (MBR tables), gdisk is newer and better (GPT tables). This wipes contents btw.
gdisk
- n (make a new partition)
- all defaults, can be strategic about partitions (boot (400M), swap (8G), / (30-50G for arch), /home for the rest)
- w (write)
- Make a filesystem:
mkfs.ext4 /dev/sda1
- Testing:
sudo mount /dev/sda1 /mnt
- If you're going to mount somewhere with existing data, right now you want to copy the contents to /mnt, potentially back them up somewhere else, and them delete the original data that you're going to mount over
sudo umount /dev/sda1
sudo mount /dev/sda1 <wherever>
- To make this happen automatically at boot, edit fstab
- Get UUID with
blkid
- To make mounting happen on boot, add a line to etc/stab with the following format (spaces or tabs separating):
UUID="<insert>" <mountpoint> <fstype(ext4?)> defaults,nofail 0 (1 if /, 2 if anything else)