Partition, format, mount and add shortcut to deck on Ubuntu

Reference:

  • https://www.howtogeek.com/106873/how-to-use-fdisk-to-manage-partitions-on-linux/
  • https://gist.github.com/keithmorris/b2aeec1ea947d4176a14c1c6a58bfc36
  • https://askubuntu.com/a/985273

List logical disks and partitions

sudo fdisk -l

Partition the disk

sudo fdisk /dev/sdb

  • Press n to create a partition
  • Press p or l to create primary or logical partitions
  • Press w to write your changes or q to quit

Format the partition

  • sudo mkfs -t ext4 /dev/sdb1
  • sudo mkfs -t ext4 -N 2000000 /dev/sdb1 – This will manually set the number of inodes to 2,000,000

Mount disk

  • mount – Shows what is mounted
  • mkdir /mnt/mydrive
  • chown <your desired user>:<group> /mnt/mydrive
  • mount -t ext4 /dev/sdb1 /mnt/mydrive

Get disk’s UUID

ls -al /dev/disk/by-uuid/
or
blkid

Mount at boot

Add the following line to your /etc/fstab file adjusting the UUID to your device’s id and the directory to where you want to mount:

UUID=811d3de0-ca6b-4b61-9445-af2e306d9999 /mnt/mydrive ext4 defaults,dmask=006,fmask=113,uid=1000,gid=33 0 0
mount -a - remounts filesystems from /etc/fstab

Add shortcut to Deck

Create a .desktop file (say custom-filemanager.desktop) in ~/.local/share/applications. You can do this by running the following command in Terminal

touch ~/.local/share/applications/custom-filemanager.desktop

Open the .desktop file using a text-editor, for example by running

gedit ~/.local/share/applications/custom-filemanager.desktop

Add the following lines to the file:

[Desktop Entry]
Name=File Manager
Comment=Access and organize files
Keywords=folder;manager;explore;disk;filesystem;
Exec=nautilus --new-window %U
Icon=org.gnome.Nautilus
Terminal=false
Type=Application
Categories=GNOME;GTK;Utility;Core;FileManager;
Actions=new-window;open-downloads;
[Desktop Action new-window]
Name=New Window
Exec=nautilus --new-window
[Desktop Action open-downloads]
Name=Open my Downloads folder
Exec=nautilus /home/YOUR-USER-NAME/Downloads
Replace YOUR-USER-NAME by your user-name in the last line.

Save the file.

Click on “Activities” and search for “File Manager”. It should appear.

Right click on the “File Manager” and select “Add to Favourites”. It should be added to the dock.

Posted in Uncategorized