need to edit the fstab file to mount a second internal disk drive, solution for #49600 (alanhaggai) doesn't work for me

Asked by peter sebregondi

For a Linux newcomer, it is EXTREMELY hard to add an internal or external disk. I have Ubuntu 11.10 beta 2. The installation guide doesn't seem to offer a lot of help on this topic.
Figured out that in order to add a second Hitachi 1.5 TB disk, in the following order I need to
- Understand that Linux different from Windows doesn't simply accept disk drives but is based on the concept of partitions
- Find the disk and partition in /dev/disk/by-id (the SATA disk was listed twice with a tiny difference 'part-1' that I don't understand)
- Find the UUID in /dev/disk/by-uuid
- Figure out how 'mount' might work (hopefully, cross my fingers :)
- Change owner of the disk
- Make mount directory (wonder if I got it right)
- Change the text file /etc/fstab/ and add a line at the end: 'UUID=1420ffce-f8ad-4436-a776-f51d363b6dc0 /hitachi1.5 btrfs'
   to mount the device.
However, the system doesn't allow me to add this line because of lack of permission.
I tried the advice from question #49600:
      To the end of the file, add this:
      kev ALL=ALL
      Save and exit the file.
      Now, you can use sudo to execute all commands as root.
      For example: sudo gedit /etc/fstab
However, it stops already at the first step:
          sebregondi@sebregondi-desktop:/$ su
          su: Fehler bei Authentifizierung (means: error with authentication)
I entered my password several times to be sure there was no typo.
Could someone kindly advise what to do to be able to use the second internal disk?
Many thanks in advance.

Question information

English Edit question
Ubuntu mountall Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Ubfan (ubfan1) said :

The traditional place to mount disks is under /mnt, so you could make the hitachi1.5 directory there instead of root.
These days, new fstab entries for directories placed in /media will be automatically mounted and an icon placed on the desktop for you.
Usually you also give some mount options, here's a typical fstab entry:
UUID="503ed1df-c89c-4d6e-a9b2-64d1fb1ccda5" /mnt/sdd1 ext3 user,noauto,nosuid,rw,relatime 0 0
To edit the fstab file, use the
sudo vi /etc/fstab
command, with your login.
Ubuntu does not have a root password, so you can never just su and become root, you are forced to use sudo, and all actions are logged.
The first user on the system had the rights needed to run sudo.

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

Ubfan, thank you very much for your advice.
I've read everything I could find about the mount command and wanted to add the following command to /etc/fstab:
UUID=503ed1df-c89c-4d6e-a9b2-64d1fb1ccda5 /media/hitachi1.5 btrfs nouser,auto,suid,rw,relatime 0 0

Don't know yet however what the two 0 at the end of the command are for... Could you kindly advise?

You suggested,
    To edit the fstab file, use the
    sudo vi /etc/fstab
    command, with your login.
I've tried to do so in the terminal.
However, at the first try I only got some info on fstab, but didn't see the fstab file itself and couldn't edit something.
The next several times I tried I always got this:
# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sdb1 during installation
UUID=e53675fc-dd64-4347-98fb-ad348ca3fc7c / btrfs defaults,subvol=@ 0 1
# /home was on /dev/sdb1 during installation
UUID=e53675fc-dd64-4347-98fb-ad348ca3fc7c /home btrfs defaults,subvol=@home 0 2
# swap was on /dev/sdb5 during installation
#UUID=f92659ae-20e3-4f66-960c-52b8e41203cf none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0
"/etc/fstab" 15 lines, 848 characters

I should mention that when I installed Ubuntu on the Seagate disk this disk was identified as sdb then and the Hitachi as sda.
 I switched the SATA cables between the Seagate and the Hitachi disks after installing Ubuntu 11.10 beta 2 on the Seagate diskto let the Seagate disk show up as sda.

So my question now is: How can I edit the fstab file after the sudo vi command didn't work?
Many thanks in advance.

Revision history for this message
Ubfan (ubfan1) said :

You need to use the UUID of your partition in the fstab line. Find it with the command:
sudo blkid
And pick out the uuid of the partition you want mounted.
The 0's just refer to checking order, see the manual pages (or info):
man fstab
You were editing the fstab file, but if you don't know the vi commands, use a gui editor:
gksudo gedit fstab
Make the directory in /media with the command:
sudo mkdir /media/hitachi1.5
That's the beauty of using UUIDs instead of the actual devices in the fstab, you may switch the disks, and things still work.

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

Thanks again, Ubjan. This has brought me quite a bit further.
Creating /media/hitachi1.5 worked.
sudo blkid was very helpful: The UUID shown for the Hitachi1.5 disk this time was different from the UUID that I found last week in Nautilus /dev/disk/by-uuid for this disk. And today Nautilus also shows the new UUID. Strange.

Anyway, with gksudo gedit /etc/fstab
I could add as the new last line with the new UUID:
UUID=1420ffce-f8ad-4436-a776-f51d363b6dc0 /media/hitachi1.5 btrfs nouser,auto,suid,rw,relatime 0 0

Rebooting worked, and the disk shows up in the Launcher as "Hitachi 1,5 TB SATA 6GB/s".

However, I can't copy a document into this disk via drag and drop as it works with USB sticks, nor can I save a document on the Hitachi disk. The error message is (translated):
      Error when storing the document Meine Frage 173866.docx on 2nd internal disk and
      fstab: /media/hitachi1.5/Meine Frage 173866.docx does not exist.

The properties of Hitachi1.5 show root as the owner.

Any advice how to get able to read and write on the disk?

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

Maybe I should also mention the result from sudo blkid for the Hitachi disk:

/dev/sdb1: LABEL="Hitachi 1,5 TB SATA 6GB/s" UUID="1420ffce-f8ad-4436-a776-f51d363b6dc0" UUID_SUB="8f6bf000-d327-4dd7-ac49-3895f8759d6d" TYPE="btrfs"

Revision history for this message
Ubfan (ubfan1) said :

Sounds like a permission issue. Change the ownership/group on the directory you want to copy things from a terminal. If you want to write to the whole disk, change the owner/group on /mnt/hitache1.5 when it is mounted.
sudo chown yourusername:yourgroup /mnt/hitache1.5

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

I've entered in the terminal:
sebregondi@sebregondi-desktop:~$ sudo chown sebregondi:sebregondi-desktop /media/hitachi1.5

However, the error message says that the group is invalid:

chown: ungültige Gruppe: „sebregondi:sebregondi-desktop“

How can I find out what "group" is in my case?

Revision history for this message
Ubfan (ubfan1) said :

All the groups are listed in /etc/group
Your group is probably the same as your username.
Not with "-desktop" appended to it.

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

I've read at
    On a Linux system, you're always a member of at least one group: your login group.
    You are the only member of this group, and its group name is the same as your username.

So I've tried:
sudo chown sebregondi:sebregondi /media/hitachi1.5

This command did not return a warning.
So I tried to save a LibreOffice doc on the Hitachi disk, but got the same error message as before (translated):
      Error when storing the document xxx.docx
      fstab: /media/hitachi1.5/xxx.docx does not exist.

Any suggestion what to do?
Thank you.

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

BTW, I would like to mention that I'm very thankful for your advice so far. I appreciate your effort to help me very much!

Revision history for this message
Ubfan (ubfan1) said :

The disk should have been mounted when you changed the owner. Now look at the permissions, and add write if necessary.
ls -ld /media/hitachi1.5
Should be owned by you, your group, with a w in the first set of 3 permissions (something like rw-r--r )
Add w if necessary with chmod:
sudo chmod +w /media/hitachi1.5
Try to create a file
chmod /media/hitachi1.5
touch foo
ls -l
should see a file foo (zero length).

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

Indeed, there was no write permission.
sebregondi@sebregondi-desktop:~$ ls -ld /media/hitachi1.5

dr-xr-xr-x 1 sebregondi sebregondi 0 1970-01-01 01:00 /media/hitachi1.5

sudo chmod +w /media/hitachi1.5
added the missing write permission:
ls -ld /media/hitachi1.5
delivered the message:
drwxr-xr-x 1 sebregondi sebregondi 0 1970-01-01 01:00 /media/hitachi1.5

Now I can write documents to the Hitachi disk. That's great!

Then I tried to create a file as you suggested, but it failed:
chmod /media/hitachi1.5

delivered the warning:
chmod: fehlender (missing) Operand nach (after) „/media/hitachi1.5“

I also tried again a bit differently:
chmod /media/hitachi1.5 touch foo

delivered the warning:
chmod: Ungültiger (invalid) Modus (mode): „/media/hitachi1.5“

So which operand do I need to add to chmod /media/hitachi1.5

Revision history for this message
Best Ubfan (ubfan1) said :

Sorry, my bad command, should have been
cd /media/hitache1.5
touch foo
All these commands have help available in the "man" (manual) pages. Just type "man chmod" or "man touch" to
get help.

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

Ubfan, Thank you very much indeed.
I appreciate your help very much.

FYI the results from your updated commands:
cd /media/hitachi1.5
sebregondi@sebregondi-desktop:/media/hitachi1.5$ touch foo
sebregondi@sebregondi-desktop:/media/hitachi1.5$ ls -l
insgesamt 0
-rw-rw-r-- 1 sebregondi sebregondi 0 2011-10-16 18:57 foo
drwxrwxr-x 1 sebregondi sebregondi 248 2011-10-16 18:58 Zweite interne Platte anlegen (means probably: define or mount 2nd internal disk)

Have a nice day.

Revision history for this message
peter sebregondi (heinz-peter-sebregondi) said :

Thanks Ubfan, that solved my question.