Page 1 of 1

External HDD with Ubuntu

Posted: Wed Nov 26, 2008 12:05 am
by Dirge
Hi I get this error "Operation not supported by backend" when I try to copy files to my newly formatted USB HDD.

I am running Ubuntu 8.04 and have formatted the drive with Ext3.

Why would only the root user be given access to this drive... is there something I have done wrong when using GParted to format the drive? Why don't I have permission to write to my newly formated drive and how can I change this?

Re: External HDD with Ubuntu

Posted: Wed Nov 26, 2008 12:18 am
by titan
You need to make sure that the user has permission to mount the drive. Post your /etc/fstab so we can see what it has to say.

Re: External HDD with Ubuntu

Posted: Wed Nov 26, 2008 9:28 am
by notfred
Are you mounting it at boot time with entries in /etc/fstab or are you hotplugging it once the OS is up?

Re: External HDD with Ubuntu

Posted: Wed Nov 26, 2008 9:46 am
by zamb
If you want to give your current user full access to the drive you need to do (in a terminal):
sudo chown username:username /PATH/TO/USBDRIVE

(Where username is the login name you use to log-in to your system, and /PATH/TO/USBDRIVE is where your USB drive is mounted. Here's an example from my system:
sudo chown zamb:zamb /media/40GB

(zamb is my login name, and /media/40GB is where my 40GB USB drive is usually mounted.)

You need to do this once!
Hope this helps.
(sudo will ask for your password.)
Ziyad.

EDIT: A little late! Didn't see the date. Sorry.

Re: External HDD with Ubuntu

Posted: Wed Nov 26, 2008 10:09 am
by just brew it!
By default, the root folder on the new drive will be writable only by root.

There are a number of ways you can deal with this. Assuming you are hot-plugging it, and it is auto-mounting itself as /media/disk, any of the following should work (do this with the drive mounted) --

To make it writable by anyone:
sudo chmod go+w /media/disk


To change the ownership, making it writable by your account only:
sudo chown myaccountname:mygroupname /media/disk


To create a subfolder that is writable by your account, while leaving the root folder of the drive writable only by root:
sudo mkdir /media/disk/myfolder
sudo chown myaccountname:mygroupname /media/disk/myfolder


There's probably a way to do this through the GUI as well, but I've never bothered to figure out how since I'm comfortable with the CLI...

Re: External HDD with Ubuntu

Posted: Thu Nov 27, 2008 3:46 pm
by Dirge
Hey guys thanks for all your support. Yes I am hot plugging the external drive and I like the idea of changing ownership. Coming in the most part from a Windows world it seems kinda weird not being given appropriate permissions when I formatted the drive.

Is there any advantage to creating a subfolder that is writable by your account, while leaving the root folder of the drive writable only by root? I heard someone mention this was the nix way of doing things as it provided more security. Is this true?

Would I encounter any problems with this method if I later upgraded to Ubuntu 8.10 and changed to a different user account. I assume if it was in the same group I would be alright. What about using the drive with a different distro? I am guessing it wont work without changing ownership again.

Re: External HDD with Ubuntu

Posted: Fri Nov 28, 2008 1:05 am
by titan
The way Linux views storage space is different from Windows and Mac. It's all one contiguous file system as far as Linux is concerned. For simplicity's sake, that's what it is, but it is not equivalent to JBOD. If the external drive is being mounted to the root (/)directory, then what the person told you is true. There does not really have to have a subdirectory on it. The thing is to be sure that the external drive is mounted to the appropriate location within the Linux directory structure (e.g. /mnt/usbdrive).

My guess as to why the drive was owned by root is that it was created by root; GParted was run with the root account. In which case, what the distro had done was reasonable as that's how Linux is supposed to work; automatically set the permission according to who created it.

Re: External HDD with Ubuntu

Posted: Fri Nov 28, 2008 11:48 am
by just brew it!
Dirge wrote:
Is there any advantage to creating a subfolder that is writable by your account, while leaving the root folder of the drive writable only by root? I heard someone mention this was the nix way of doing things as it provided more security. Is this true?

If the drive will be used by more than one user, you may want to do things this way so that each person can have their own subfolder with the appropriate permissions. If you will be the only user, then there is probably not a big advantage to doing things this way.

Would I encounter any problems with this method if I later upgraded to Ubuntu 8.10 and changed to a different user account. I assume if it was in the same group I would be alright. What about using the drive with a different distro? I am guessing it wont work without changing ownership again.

If you are in the same group, and the group permissions allow writing, it will still work.

Also note that Linux user IDs (as stored internally in the file system) are just numbers; IIRC the first user created on an Ubuntu system is user ID 1000. If you do another fresh install, the first user created will get the same numerical user ID (and so will effectively be the same user as far as attached storage devices are concerned), even if the name is different.

Re: External HDD with Ubuntu

Posted: Fri Nov 28, 2008 3:54 pm
by Dirge
Thanks guys! I mean it :)

Re: External HDD with Ubuntu

Posted: Fri Nov 28, 2008 6:48 pm
by notfred
just brew it! wrote:
Also note that Linux user IDs (as stored internally in the file system) are just numbers; IIRC the first user created on an Ubuntu system is user ID 1000. If you do another fresh install, the first user created will get the same numerical user ID (and so will effectively be the same user as far as attached storage devices are concerned), even if the name is different.
And also a quick find/chown command can easily switch the files that belonged to the old userid to the new userid.