Set Up SSD Drive
With so many disk intensive activities on the horizon, it makes sense to do as many of those as possible on a true SSD.
After you have physically mounted/installed the NVMe stick, perform the following steps:
- Figure out the device: “ls /dev/nvmen*”. In my case (and probably yours), “/dev/nvme0”. We don’t need to partition our SSD drive into separate “sub-drives”: one big drive is what we want. So:
$ sudo mkfs.ext4 /dev/nvme0n1
- Create an empty folder where we’ll mount our new drive. I’m using /mnt/ssd — use what makes sense to you:
$ mkdir -p /mnt/ssd
- Edit /etc/fstab to add a line (so your OS can auto-mount the new drive on boot):
/dev/nvme0n1 /mnt/ssd ext4 defaults 0 0
- Test your work:
$ sudo mount -aThis manually mounts your drive. You should get no error messages.
$ df -hProduces a list. You should see a line listing your new drive and mount folder.
Let’s also set up a swap file on our SSD. Opinions vary how large it should be. Here is a good article. For Ubuntu systems with more than 1G of memory, the recommended swap size is the square root of RAM. If you’re going to use hibernation, add the size of RAM. I’m not interested in hibernation, so I’m going with 3G of swap space.
- Create a file that will be used for swap:
$ sudo fallocate -l 3G /mnt/ssd/swapfile
- Only root should be able to write and read the swap file:
$ sudo chmod 600 /mnt/ssd/swapfile
- Use mkswap to set up the file as Linux swap area:
$ sudo mkswap /mnt/ssd/swapfile
- Enable the swap:
$ sudo swapon /mnt/ssd/swapfile
- To make the change permanent open /etc/fstab file and append the following line:
/mnt/ssd/swapfile swap swap defaults 0 0
- o verify that the swap is active:
sudo swapon --show