How to fix external hard disk READ ONLY?
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 ?
Solution 1:
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 commandid
and use the number afteruid=
. -
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:
sudo umount /dev/sdc1
- This unmounts the drive.
sudo mkdir toshibaHDD
- This will create a new mount point.
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 giverwxrwxr--
permissions to everything (directories and files) inside the drive. Alternatively, you can usedmask
andfmask
instead ofumask
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:
- Unplug your external hard disk.
cd /etc
sudo cp fstab fstab.bak
- This takes a backup of the file we're about to edit.
sudo nano fstab
- This opens up the
fstab
file in a text editor.
-
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
-
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.
Solution 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
Solution 3:
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.