Can't Write To Ext2 External HD But Reads Okay
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?
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
/dev/sda5 /mnt/usb80hd ext2 defaults 0 0
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.
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
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 :D ) 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.
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).
/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.
Do a 'man fstab' for more information.
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.
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.
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.
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.
|All times are GMT -5. The time now is 12:28 AM.|