Add a partition in linux

  1. Create the new partition
    1. Create the partition
    2. Create the directory
    3. Mount the partition
    4. Set it in fstab

Create the new partition

Create the partition

chose the hard drive:

fdisk -l
language-noneCopy

And them create the partition:

cfdisk /dev/sda
language-noneCopy

Once it’s done you have to set the type.

mkfs.ext4 /dev/sda2
language-noneCopy

For me it’s sda2 because I already use sda1 for the downloads, the sda2 will be for my games.

Create the directory

Create the directory for the partition:

mkdir /home/peanutstick/games
language-noneCopy

And give the own:

sudo chown peanutstick $HOME/games -R
language-noneCopy

Mount the partition

mount /dev/sda2 /home/peanutstick/games
language-noneCopy

Set it in fstab

If you don’t do if the changes will not be saved after a reboot.

sudo vim /etc/fstab
language-noneCopy

Now add this:

/dev/sda2 /home/peanutstick/games ext4 defaults 0 0
language-noneCopy