- Start
fdisk
- change/dev/sda2
with your harddrive.
sudo fdisk /dev/sda
- Select
p
to view all partitions. - Select
n
to create a new partition. - Type
p
for primary partition. - Enter which number partition the partition is on the harddrive. Typically
1
. - If the partition needs to fill up all the space on the harddrive, just press enter at
start sector
andend sector
. - Select
w
to write changes to the disk. - Reboot.
- Make the filesystem with
mkfs
sudo mkfs.ext4 /dev/sda2p1
- Remember to create a mounting point, eg.
/mnt/hdd
. - Edit
/etc/fstab
sudo nano /etc/fstab
- Add a new mounting point at the bottom (new line)
- Type in like below - partition, mounting point, partition type, flags, fs_freq, fs_passno
/dev/sda2p1 /mnt/hdd ext4 rw,defaults 0 0
- Save and exit fstab
- Test if the new mount works by mounting all from fstab
sudo mount -a
- This shouldn't produce any errors, and this automatically mount the harddrive - even after reboot.
If you need to unmount the partition again:
sudo umount /mnt/hdd