LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 11-07-2006, 02:55 PM   #1
rrrssssss
Member
 
Registered: Mar 2005
Posts: 266

Rep: Reputation: 32
Can't Write To Ext2 External HD But Reads Okay


Hello forum,

I've just reformatted my 80 gig external USB hard drive (sda5) with the ext2 file system and it mounts fine but I can't write to it unless I am in root.

In fstab I have tried umask=0 and also tried UID=500 but neither worked.

Can you help me?

Roy


fdisk -l

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 2 9729 78140160 f W95 Ext'd (LBA)
/dev/sda5 2 9729 78140128+ 83 Linux



fstab

/dev/sda5 /mnt/usb80hd ext2 defaults 0 0

Last edited by rrrssssss; 11-07-2006 at 03:00 PM.
 
Old 11-07-2006, 03:53 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,298

Rep: Reputation: 138Reputation: 138
You only use "umask" in the fstab entry for FAT and FAT32 filesystems. For native linux filesystems, you just have to change the permissions on the mount point while the partition is mounted; it will not work if you change the perms on the mount point with the partition unmounted. In your case, mount your external hard drive, sda5, and run as root:

# chmod 777 /mnt/usb80hd

That shoud give the world rwx permissions on the device.
 
Old 11-07-2006, 03:54 PM   #3
poweredbydodge
Member
 
Registered: Oct 2006
Location: Buffalo, NY
Distribution: Servers: Scientific Linux 5.x // Desktops: Fedora Core (latest)
Posts: 110

Rep: Reputation: 15
Post

This is a 'pull it outa my rear' idea, but it is based in some common sense.

Many externally connected devices through USB and Firewire default (in Windoze -- and so far my Digital Camera has done the same under Fedora Core 5 Linux) in read-only mode.

So fstab ........... 'defaults' may be causing it to mount as read only.

'rw,suid,dev,exec,auto,nouser,async' is equivelant to a normal 'defaults'

'rw,suid,dev,exec,auto,user,async' will be what we will try instead

But I digress, try this in fstab...

/dev/sda5 /mnt/usb80hd ext2 rw,suid,dev,exec,auto,user,async 0 0

I also have no love for priortizing secondary drives with 0 0...

/dev/sda5 /mnt/usb80dh ext2 rw,suid,dev,exec,auto,user,async 2 1

Moving along...

If that doesn't work, then you may want to investigate whether you can successfully mount a device-drive itself, as opposed to a partition on that drive.

For example, /dev/hda is an PATA EIDE hard drive on one of my machines. (no, its not the boot drive, that's /dev/hde -- don't ask ) I have been unable (on that machine) to mount /dev/hda. However, once I partition /dev/hda into one or more paritions -- say /dev/hda1 /dev/hda2 and /dev/hda3 -- then I am able to mount all of them individually with simple commands like...
/dev/hda1 /mnt/my_drive_1 xfs defaults 2 1
/dev/hda2 /mnt/my_drive_2 xfs defaults 2 1
/dev/hda3 /mnt/my_drive_3 xfs defaults 2 1
... where xfs replaces ext2 -- as I use the xfs file system on most of my stuff.

The only exception to this "no-likey-mounting-actual-device-drives" deal is when I mount Linux-generated software-raid drives.

Then I am able to do something like...
/dev/md0 /mnt/raid_drive_1 xfs defaults 2 1
/dev/md0 /mnt/raid_drive_2 xfs defaults 2 1

... but only after I have used:
# mkfs.xfs /dev/md0
# mkfs.xfs /dev/md1

to format the drives manually to the xfs file system... similar can be done with ext2 as well as every other file system.

With raid drives I choose not to create a partition on them, and simply manually format the whole device.

Why? I honestly don't know. For all I know, I could be doing something horribly wrong, but it seems to work.

That is neither here nor there though.

I would suggest the previous /etc/fstab modifications, and then let me know what happens.
 
Old 11-07-2006, 03:55 PM   #4
poweredbydodge
Member
 
Registered: Oct 2006
Location: Buffalo, NY
Distribution: Servers: Scientific Linux 5.x // Desktops: Fedora Core (latest)
Posts: 110

Rep: Reputation: 15
re: chmodding.

I thought that went without saying, but my apologies for the long winded reply if that was your only problem.

Hopefully it is! -- easy fixes are always the most enjoyable, as they tend not to break one's soul into tiny bits and make one consider going back to Windoze (the afore mentioned Devil).
 
Old 11-07-2006, 03:56 PM   #5
johndoe0028
Member
 
Registered: Jun 2005
Location: CA, USA
Distribution: Gentoo
Posts: 165

Rep: Reputation: 30
/dev/sda5 /mnt/usb80hd ext2 defaults 0 0

Should be changed to something like

/dev/sda5 /mnt/usb80hd ext2 user,noauto 0 0

column 4 is the mount options for the device. "Users" allows normal non-root users to mount/unmount the device. "Noauto" means that it won't be automatically mounted.

When that line is changed, try mounting the drive as a normal user.

mount /dev/sda5
Do a 'man fstab' for more information.

Last edited by johndoe0028; 11-07-2006 at 03:58 PM.
 
Old 11-07-2006, 05:55 PM   #6
rrrssssss
Member
 
Registered: Mar 2005
Posts: 266

Original Poster
Rep: Reputation: 32
I think It is Fixed - Thanks

Thanks to kilgoretrout, poweredbydodge, and johndoe0028,

I used the line "dev/sda5 /mnt/usb80hd ext2 user,auto 0 0" in fstab then I used as root "chmod 777 /mnt/usb80hd" and the external hard drive will now read, write, and execute as a non root user.


Question:
When I used the command "chmod 777 /mnt/usbhd80" in the root terminal window, was this a permanent change? I mean did I actually change permissions that will withstand a re-boot of the computer? Many changes will revert to default again once the computer is re-booted.

I might next try using the line poweredbydodge suggested.

Thanks much,
Roy
 
Old 11-07-2006, 06:42 PM   #7
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,298

Rep: Reputation: 138Reputation: 138
Quote:
Question:
When I used the command "chmod 777 /mnt/usbhd80" in the root terminal window, was this a permanent change? I mean did I actually change permissions that will withstand a re-boot of the computer? Many changes will revert to default again once the computer is re-booted.
Unless you have some service, daemon or script that resets permissions, the change should survive a reboot. That's the way it's always worked for me.
 
Old 11-07-2006, 08:42 PM   #8
johndoe0028
Member
 
Registered: Jun 2005
Location: CA, USA
Distribution: Gentoo
Posts: 165

Rep: Reputation: 30
Also, since the device was mounted with user-control permissions, then non-root users should be able to read and write to it from now on.

This, however, only applies if a non-root user mounts it. If root mounts it, then it will be read/write only for root.
 
Old 11-08-2006, 11:30 AM   #9
poweredbydodge
Member
 
Registered: Oct 2006
Location: Buffalo, NY
Distribution: Servers: Scientific Linux 5.x // Desktops: Fedora Core (latest)
Posts: 110

Rep: Reputation: 15
the /mnt directory and the /usb80 drive(or partition) will retain their chmodding. however, if you write a file (say you dump a file called 'my_file.txt' on there) then that file will have the permission that you give it, which is likely 755. if you have other users accessing the drive, then they may not be able to write to or delete the file (but will be able to write to and read from the drive itself. if you're a one-user system, then don't sweat it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non-root write access to a USB drive (ext2) ?? jmborr Linux - Hardware 4 10-17-2005 02:38 PM
USB Stick reads but won't write jaws_tas Linux - Hardware 3 09-23-2005 12:36 AM
External Harddrive reads very slow RoaCh Of DisCor Slackware 20 06-29-2005 03:36 PM
Problems using an external burner (reads, but doesn't burn) JenK Linux - Newbie 3 03-18-2004 10:53 PM
cd burner reads but won't write Scott176 Linux - Hardware 2 12-17-2002 04:25 AM


All times are GMT -5. The time now is 09:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration