52

I have got an external hard disk TOSHIBA 1TB USB 3, the permission is always READ ONLY.

fdisk -l (output) :

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf2198b37

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2046   362369023   181183489    5  Extended
/dev/sda3       362371072   976771071   307200000    7  HPFS/NTFS/exFAT
/dev/sda5            2048      976895      487424   83  Linux
/dev/sda6          978944   362369023   180695040   83  Linux

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeba6fb57

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1           16065   312576704   156280320    f  W95 Ext'd (LBA)
/dev/sdb5           16128   312573708   156278790+   7  HPFS/NTFS/exFAT

Disk /dev/sdc: 1000.2 GB, 1000204885504 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525167 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x297c35de

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63  1953520064   976760001    7  HPFS/NTFS/exFAT

How can I change the owner and permission of this hard drive ?

screenshot

moata_u
  • 5,413
  • 1
    Try sudo mount -o remount,uid=1000,gid=46,rw /dev/sdc1 in a terminal. – Alaa Ali Aug 16 '13 at 09:37
  • @ Alaa still same permission nothing changed !! – moata_u Aug 16 '13 at 09:50
  • What is the output of the commands mount | grep sdc and id? Also, check the permissions of a folder inside your drive, not the actual "TOSHIBA" folder. – Alaa Ali Aug 16 '13 at 09:54
  • /dev/sdc1 on /media/TOSHIBA type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096,uid=1000,gid=46,uid=1000,gid=46) ..... permission is = drwxr-xr-x 1 root root – moata_u Aug 16 '13 at 11:15
  • I've posted an answer. The first command is what you tried before, so you may skip it and start from the numbered steps. – Alaa Ali Aug 16 '13 at 14:54
  • I got this very same issue and I have found out the solution for this: You should open the Disks application and repair the filesystem on your external disk. I did that and it fixed this issue for me. – gyurix May 21 '20 at 23:26

5 Answers5

70

Try executing the following command in a terminal:

sudo mount -o remount,uid=1000,gid=1000,rw /dev/sdc1

Explanation:

  • -o means "with these options".
  • remount - remounts the drive over the same mount point with the same previous options.
  • uid=1000 - this option makes the user with id 1000 the owner of the drive. This is probably your username's id if you only have one username. If you have more than one username on your system, run the command id and use the number after uid=.
  • gid=1000 - this option makes the group with id 1000 the group owner of the drive. Same notes as previous point.
  • rw - this option mounts the drive as read/write. It was probably read/write anyways, but this is just to double check.
  • /dev/sdc1 is the name of the partition or device (can be checked in GParted in case you need to do the same with a different hardisk)

Since you've already tried this command and it didn't work, let's try manually mounting the drive. Follow the below:

  1. sudo umount /dev/sdc1
  • This unmounts the drive.
  1. sudo mkdir toshibaHDD
  • This will create a new mount point.
  1. sudo mount -o rw,uid=1000,gid=1000,user,exec,umask=003,blksize=4096 /dev/sdc1 /media/toshibaHDD
  • user - permits any user to mount the drive
  • exec - allows for execution of binaries on this drive. You can remove this option if you want.
  • umask=003 - this will give rwxrwxr-- permissions to everything (directories and files) inside the drive. Alternatively, you can use dmask and fmask instead of umask to give separate permissions to directories and files (respectively).
  • /media/toshibaHDD - is the name of the hardisk (can be checked in GParted in case you need to do the same with a different hardisk)

Now check the permissions of your drive.


##Edit

Follow the steps to make it permanent:

  1. Unplug your external hard disk.
  2. cd /etc
  3. sudo cp fstab fstab.bak
  • This takes a backup of the file we're about to edit.
  1. sudo nano fstab
  • This opens up the fstab file in a text editor.
  1. Move the blinking cursor to the end of the file, and paste the following two lines:

     # line for mounting the external drive
     UUID=D04A-0AE4   /media/toshibaHDD  exfat   rw,uid=1000,gid=1000,user,exec,umask=003,blksize=4096   0   0
    
  2. Hit Ctrl+X, then Y, then Enter to save and close.

That's it. Now, when you plug your external hard disk in, it will always have those options.

Laura
  • 3
Alaa Ali
  • 31,535
  • 1
    Still same problem : drwxr-xr-x 1 root root 131072 Jan 1 1970 external – moata_u Aug 16 '13 at 15:21
  • wowowo ,, thanks its work 100% just forget to add user i mean (my user).. – moata_u Aug 16 '13 at 15:23
  • still have problem your way fix the issue for a while after i start use it the hard disk umount , and can't see until i remove it and then i need to do it again and again !! – moata_u Aug 16 '13 at 20:47
  • 1
    No worries, we'll make it permanent. While your hard disk is connected and mounted, what's the output of sudo blkid? – Alaa Ali Aug 16 '13 at 21:45
  • /dev/sda3: UUID="48CE8013CE7FF790" TYPE="ntfs" /dev/sda5: UUID="8ef79eb5-988f-4634-b94c-e3830c7d5ecf" TYPE="ext4" /dev/sda6: UUID="2a5c539e-aa76-43b8-bcde-a060a64fd77a" TYPE="ext4" /dev/sdb5: LABEL="Moata" UUID="1EB62796B6276E09" TYPE="ntfs" /dev/sdd1: LABEL="TOSHIBA" UUID="D04A-0AE4" TYPE="exfat" – moata_u Aug 16 '13 at 21:56
  • @moata_u check the "Edit" section in my answer and report back once you re-plug your hard drive. – Alaa Ali Aug 16 '13 at 22:22
  • Error mounting: mount exited with exit code 1: helper failed with: mount: only root can mount /dev/sdc1 on /media/toshiba_HDD – moata_u Aug 16 '13 at 22:58
  • now when i try to open the external hard disk , i got the error i can't even read the files ! – moata_u Aug 16 '13 at 23:12
  • i have seen many answer , all of them have been tested on ubuntu 12.10 , so am downloading ubuntu 12.10 , and will try it ... what you think ? – moata_u Aug 16 '13 at 23:36
  • @Allaa , when i do it , and start copy something after 3,4 sec all the hard disconnect (umount) then mount automatically , the external hard disk keep disconnecting !! any idea – moata_u Aug 17 '13 at 11:52
  • @moata_u sorry, been away. I have no idea why it unmounts automatically, but I don't think that's a problem with the root/read-only situation. Try these basic troubleshooting steps:: connect it to a different port, and try another cable. And by the way, you can always put a # in front of the second line we added in /etc/fstab, that basically undos everything we made, and bring everything back the way you had it before. Did you upgrade to 12.10? What are the answers you saw tested on 12.10? They should apply for 12.04 normally without needing to upgrade. – Alaa Ali Aug 18 '13 at 14:56
  • when i start copy files to the hard disk , after 3,4 sec its unmount , then remount automatically ... i have test all USB ports , and i have test it on another machine with same problem , i have upgrade to ubuntu 12.10 same issue , i have change the type from exfat to fat32 same issue !!! – moata_u Aug 18 '13 at 20:01
  • the log file : (paste.ubuntu.com/6000846) – moata_u Aug 19 '13 at 09:21
  • It's another issue @moata_u. Start another question by including the paste.ubuntu.com link. But wait, can you add blksize=4096 to the options in the fstab line we added? I edited my answer. – Alaa Ali Aug 19 '13 at 13:05
  • i have added blksize=4096 , still same issue .. – moata_u Aug 19 '13 at 14:54
  • Okay, then ask another question, because that's a different issue. As you may know, this site is one question per post. Also, it will help others with the same issue when you post it as another question, because that way, they'll be able to search it. – Alaa Ali Aug 19 '13 at 15:22
  • I had an issue with hfsplus, solved by:
    `sudo mount -t hfsplus -o remount,force,rw /mount/point`  Reference: (https://askubuntu.com/questions/332315/how-to-read-and-write-hfs-journaled-external-hdd-in-ubuntu-without-access-to-os)
    
    – Nir Dec 03 '20 at 11:01
  • Is there a way to make it so that devices are NEVER mounted as read-only? – Raleigh L. Jul 16 '23 at 00:58
5

Neither the answers here nor those given to the SO superuser question Why is my USB Flash Drive Now Read-Only? solved my problem.

For no obvious reason, I couldn't write to my 1Tb Toshiba USB hard drive using my Ubuntu 20.04 system (which I've been doing every day for months without a problem).

Earlier in the day I'd connected the USB drive to a different machine, running Windows 10. So far as I recall, I never actually wrote anything to the drive from Windows, so I never bothered going through the "Eject" process. But I've just reconnected the drive to the Windows machine, immediately ejected it, and reconnected to the Ubuntu machine - and everything's back to normal!

In retrospect the cause (and hence the solution) now seems obvious, but it had me tearing my hair out for several minutes. So I'm posting it here in hopes it might help other people if they get into the same position.


TL;DR: If your USB drive suddenly becomes READONLY to Ubuntu after being connected to a Windows system, try reconnecting and doing a controlled "Eject device" on the Windows system.

FumbleFingers
  • 226
  • 2
  • 13
2

i shall just mention this here but when I plug my external HDD which is in a caddie sometimes it produces the Read-only situation which means NO adding to it ... it seems sudo umount of said volume followed by sudo mount simply cures that for a while at least [may have to repeat]... no idea why that is but it simply does

shantiq
  • 567
2

Another data point: I solved my identical problem doing what FumbleFingers described, but plugging back in to Ubuntu and doing an "Unmount Volume" (I'm using Xubuntu and this is the command in Thunar). I didn't need to plug/unplug from a different OS.

0

I resolve the same problem simply by using KDE partition manger to update my fstab file. (Gparted should also work) I also chose and create a permanent folder as the mount point for my external HD. To be more specific for the only partition on it. (encrypted luks ext4)

First, before using the partition manager, I created the mounting point folder. (mkdir /media/myusername/backupdrive) This new folder is own by myusername and mygroup and is having rwxrwx---permissions.

Then I started KDE partition manager to change the partition properties and mount point. (must not be mounted) Using the checkbox I specified the appropriate properties for my partition such as :

  • noauto so it wont try to mount it at boot
  • users so any users may mount it in the GUI or else
  • Read-write (rw) is by default so no need to specified it

By applying the changes KDE partition manger added this line to /etc/fstab config file. You may also add it manually.

UUID=THE_UNIQUE_ID_NUMBER_OF_MY_PARTITION /media/"myusername"/backupdrive ext4 noauto,users 0 0

Now my partition (hard drive) is always mounted in read-write. When I plug it in, I get a popup in the GUI asking for the password (because mine is encrypted) and it works exactly as a USB flash drive.

I did the same in my other Linux computer so I can use the drive to backup both or transfer big files.

Jey
  • 21