Be carefull when working on drive
When a storage device is plugged, it appear as its own file in /dev/deviceName
See the device connected and partition with lsblk or sudo fdisk -l.
The device have standard name like so:
Drive: sd(a|b|c…), ex: sde
Partition: sd(a|b|c…)(1|2|3…) ex: sde4
Tips: run those cmd before and after connecting a device to easily see which one it is.
Target either a entire drive or a partition with their respective name:
ls-l /dev/sde
ls-l /dev/sde4
Using fdisk
In terminal, enter sudo fdisk /dev/sde
key
action
m
help
p
print drive info
n
create new partition
Create a partition with fdisk
sudo fdisk /dev/sde
type p to print info on the disk and see if there is partition already existing
press n to create a new partition
select the number, for example 1 would give sde4
for first sector, press enter unless you have reason to change it
for last sector, either press enter to take the whole disk or specify a last to give it a certain amount of space. (type +100G for a 100gb partition, can be used with K,B,M,G…)
press w to write the change (!! if the change are overwriting data, it take effect once this step is entered)
The partition should be created. But not mounted nor formatted so not usable. (keep reading)
Format partition with mkfs
sudo mkfs.<filesystem> /dev/sde4
ex for Linux sudo mkfs.ext4 /dev/sde4
Mount a drive or partition manually
Assign a given location to access a drive. Mount either in:
/media/: for temporary devices (usb key…)
/mnt/: for more permanent devices (second ssd…)
You can mount in any location but those two are conventional.
Open a terminal
Make a dir for mounting the drive, for exemple: sudo mkdir /mnt/disk1
Find the disk or partition with lsblk
Mount it: sudo mount /dev/sde4 /mnt/disk1
Unmount a drive or partition
Use umount and the location where the drive/partition is mounted. it is umount and not unmount, no n after the u.
sudo umount /mnt/disk1
Mount a drive automatically
Be extra carefull with fstab
/etc/fstab is a file used by the Linux system to automatically mount drive at startup.
It is best to separate your entry lines from the one already existing with a line break.