I'm going to use an example from my system. Your system will have different drive names, so please adjust accordingly
First, check that the drive is mounted and find its location:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 461.4G 0 part /
└─sda3 8:3 0 3.9G 0 part [SWAP]
sdb 179:0 0 3.7G 0 disk
└─sdb1 179:1 0 3.7G 0 part
The filesystem on the other drive, sdb1
isn't mounted, so I'm going to mount it using the udisksctl
utility
$ udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /media/zanna/WORK STUFF
Now I can cd
to the mountpoint like this:
zanna@xubi:~$ cd /media/zanna/WORK\ STUFF/
zanna@xubi:/media/zanna/WORK STUFF$
note the \
character in the path, needed to escape the space. You can type this yourself, or just press TAB after typing the first few characters of the name.
To make sure the filesystem gets mounted at boot time, you could add a line for it to your /etc/fstab
, if there is not already one present. You can create a mountpoint for the drive with any name you like:
mkdir /media/$USER/mydrive
Exactly what this should look like depends on the filesystem type. It's more robust (IMHO) to mount disks by UUID than by label, so to get the UUID and filesystem type with one command, use
$ sudo blkid
[...]
/dev/sdb1: UUID="2d8afeac-c623-4be7-b261-44920e6b8e71" TYPE="ext4" [...]
The filesystem type in this case is ext4, so what I would then do is
sudo cp /etc/fstab /etc/fstab.bak
sudoedit /etc/fstab
and check that there is not already a line there for the partition - duplicate lines for the same partition will cause errors. If there is not, then I would add a line at the end including the UUID (use the one you got from blkid
, not my example below!), the mount point and the filesystem type like this:
UUID=2d8afeac-c623-4be7-b261-44920e6b8e71 /media/zanna/mydrive ext4 defaults 0 0
If the partition is an NTFS partition, the line would be
UUID=2d8afeac-c623-4be7-b261-44920e6b8e71 /media/zanna/mydrive ntfs-3g auto,user,rw 0 0
If you need to revert any changes you made, restore your backup:
sudo mv /etc/fstab.bak /etc/fstab
For more information about /etc/fstab
, see the Ubuntu help page.
To set a default directory for terminal sessions, see Setting default path when opening a terminal session.
NB: In general, using etckeeper is preferable to making vulnerable ad-hoc backups of stuff in /etc
mount -l
in a code block ({}
button). – dessert Aug 29 '17 at 16:20