In Ubuntu I have an external USB drive that gets automounted when accessed through Nautilus. The problem is that if I first open up a terminal and try to access the files, they're not there. I have to first access the drive through Nautilus. After that a folder is created in the /mount directory and I can access the files in the terminal.

How can I get access to the drive in the terminal without first having to access it like this?

link|improve this question

74% accept rate
feedback

2 Answers

up vote 6 down vote accepted

As Mattias suggested (+1) the /etc/fstab is the place to add correct entry.

But, you may want to identify the block device in different way. For example if you have another pendrive/disk/sdcard connected the /dev/sda1 may not be block device you want.

Determine label or UUID by:

sudo blkid

and all entry to /etc/fstab in format:

UUID=85104805-cef7-41c6-9665-934e3c5ef1eb     /mount     ext3     defaults 0   0

or:

LABEL=MYPEN     /mount     ext3     defaults 0   0
link|improve this answer
+1 this way is better as UUID won't change and /dev/sda1 can change depending on what devices you have connected. – laurent Jan 13 at 2:20
UUID can change, but it's a PITA to do and you can't do it accidentally. – Rob Jan 13 at 15:41
@Rob: I think, to change UUID you will need to backup data, recreate filesystem and restore the data. Didn't try it. – Michał Šrajer Jan 13 at 21:02
No, there's definitely a way to do it otherwise. I found out after copying a partition with gparted. – Rob Jan 15 at 15:49
@Rob: by copying a partition, parted recreates a similar filesystem under the cover. Anyhow, you are right, there is probably several ways to change a UUID, but fortunately it's not that easy to do it by mistake. – Michał Šrajer Jan 16 at 1:45
feedback

If your USB drive is always connected you can put an entry in your /etc/fstab file if you figure out what devicename it has. To figure it out, when you have the volume mounted with Nautilus, open a Terminal and write mount and then check the output for the proper device. Then edit /etc/fstab with this, for example:

/dev/sda1     /mount     ext3     defaults 0   0
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.