USB drive won't mount, but still works( I think! ).

CataclysmicGentleman

Active Member
Joined
Jan 18, 2023
Messages
307
Reaction score
109
Credits
2,594
I used testdisk to copy files off of my 128 GB kingston usb, theres nothing on it I need to keep, it was just meant to be a sort of backup.

that being said, here is what my issue is: ever since I tried to tell my laptop to make a backup of its system onto the USB drive, it bricked it, not literally, sort of.. let me explain.

My computer detects it, can copy files off of it, (with the proper CLI tool) and I can try to mount it, however it says it cannot mount due to being read only.

That's the other thing I should mention: all the files copied off the drive were under "root" as owner and group instead of "insertname" (me) so I had to use the chown command to give myself permission to copy and paste my own files.

ALL that to say, help! I have asked ai chatbots and searched online, I have asked knowledgeable friends and still, nothing works. I just want to format the drive! wipe it clean. It worked perfectly fine before I told my pc to use it as a system backup! Timeshift never did this to me- good ole timeshift.. lol!

TLDR: USB drive won't mount after trying to use it as a Debian system backup on KDE, all files copied off via Testdisk are under the ownership of "root" (higher then my account though I am the sudo/admin etc) Gparted also says its read only, when trying to do anything (delete format etc). help!
 


Also: tried plugging it into windows (my wife refuses to use linux lol!) and seeing what it said: it said that the drive was write protected.
 
I used testdisk to copy files off of my 128 GB kingston usb, theres nothing on it I need to keep, it was just meant to be a sort of backup.

that being said, here is what my issue is: ever since I tried to tell my laptop to make a backup of its system onto the USB drive, it bricked it, not literally, sort of.. let me explain.

My computer detects it, can copy files off of it, (with the proper CLI tool) and I can try to mount it, however it says it cannot mount due to being read only.

That's the other thing I should mention: all the files copied off the drive were under "root" as owner and group instead of "insertname" (me) so I had to use the chown command to give myself permission to copy and paste my own files.

ALL that to say, help! I have asked ai chatbots and searched online, I have asked knowledgeable friends and still, nothing works. I just want to format the drive! wipe it clean. It worked perfectly fine before I told my pc to use it as a system backup! Timeshift never did this to me- good ole timeshift.. lol!

TLDR: USB drive won't mount after trying to use it as a Debian system backup on KDE, all files copied off via Testdisk are under the ownership of "root" (higher then my account though I am the sudo/admin etc) Gparted also says its read only, when trying to do anything (delete format etc). help!
Usbs usually have fat32 or similar filesystems, and also usually mount with files owned by root. The fat32 filesystem has no notion of owner/root/other permissions but this is not a problem for linux.

The following observations are based on post #1 as I understand it, but may have missed something.
My computer detects it, can copy files off of it, (with the proper CLI tool) and I can try to mount it, however it says it cannot mount due to being read only.

This is unclear to me. If the computer can copy files from the usb, it must have been mounted, so the user would have no need to mount it. It could have been mounted by the automatic mounting facility of the Desktop Environment, or could have been mounted manually by the user.

In relation to this quote:
it cannot mount due to being read only
it's unclear because usbs are quite able to be mounted read only.
It would be useful to see the exact message that appears on screen when mounting fails.

all files copied off via Testdisk are under the ownership of "root"
This root ownership of files on the usb is commonly the case and doesn't prevent a user from writing to and from the usb as well as reading it. The usb just needs to be mounted in the correct way. Permissions don't need to be changed.

The following is what I would try as a proof of concept that the usb mounting and read/writing is all workable on the system.

I would configure KDE to not automount the usb. There is a setting somewhere under something like "removable media" where the automounting can be disabled. Not having KDE here at the moment I can't be exact.

Then plug the usb in, find the device name of the usb with the command: lsblk.

To mount the usb, so that a user can write to and from it, as well as read it, the following command as root is usually sufficient without having to change any permissions. Note I've used the /dev/sdb1 device name and mounted it at the mount point /mnt, but you need to have the correct device name that's relevant on your system:
Code:
mount /dev/sdb1 /mnt -o umask=0
The umask option effectively tells the system to ignore permissions.

To check whether the usb is mounted, run the command: mount. The entry showing the usb device name should be near the end of the output if it's mounted.

One can write a test file to the mounted usb then, and then copy it back to the user's home directory to see if it works. For example:
Code:
touch testfile /mnt
cp /mnt/testfile ~

To unmount it, also as root run:
Code:
umount /mnt

It may be possible to mount the usb using the udisksctl command as user, for example:
Code:
$ udisksctl mount -b /dev/sdb1
Mounted /dev/sda1 at /media/ben/STORE N GO
Note that the udisksctl command outputs where the device has been mounted where it becomes available for reading and writing to and from.

To unmount the usb one runs:
Code:
udisksctl unmount -b /dev/sdb1

Note that when unmounting the usb, the user should no longer be in the directory of the mount point.

If none of the above works, then you might consider reformatting the usb. However, if you find that another usb, known to be good, also fails to mount with the above commands, then the problem may be elsewhere.
 
Last edited:
I have found this tutorial, I hope can help you to solve the problem.
Disk /dev/sda: 115.47 GiB, 123983626752 bytes, 242155521 sectors
Disk model: DataTraveler 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2a283129

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 242155519 242153472 115.5G 83 Linux
username@debian12:~$ mkdir /media/usb-drive
mkdir: cannot create directory ‘/media/usb-drive’: Permission denied
username@debian12:~$ sudo mkdir /media/usb-drive
username@debian12:~$ su
Password:
root@debian12:/home/username# mount /dev/sda1 /media/usb-drive/
mount: /media/usb-drive: cannot mount /dev/sda1 read-only.
dmesg(1) may have more information after failed mount system call.
root@debian12:/home/username#

also when I try and use dolphin:


An error occurred while accessing 'usbthumbdrive', the system responded: The requested operation has failed: Error mounting /dev/sda1 at /media/username/usbthumbdrive: cannot mount /dev/sda1 read-only
 
Usbs usually have fat32 or similar filesystems, and also usually mount with files owned by root. The fat32 filesystem has no notion of owner/root/other permissions but this is not a problem for linux.

The following observations are based on post #1 as I understand it, but may have missed something.


This is unclear to me. If the computer can copy files from the usb, it must have been mounted, so the user would have no need to mount it. It could have been mounted by the automatic mounting facility of the Desktop Environment, or could have been mounted manually by the user.

In relation to this quote:

it's unclear because usbs are quite able to be mounted read only.
It would be useful to see the exact message that appears on screen when mounting fails.


This root ownership of files on the usb is commonly the case and doesn't prevent a user from writing to and from the usb as well as reading it. The usb just needs to be mounted in the correct way. Permissions don't need to be changed.

The following is what I would try as a proof of concept that the usb mounting and read/writing is all workable on the system.

I would configure KDE to not automount the usb. There is a setting somewhere under something like "removable media" where the automounting can be disabled. Not having KDE here at the moment I can't be exact.

Then plug the usb in, find the device name of the usb with the command: lsblk.

To mount the usb, so that a user can write to and from it, as well as read it, the following command as root is usually sufficient without having to change any permissions. Note I've used the /dev/sdb1 device name and mounted it at the mount point /mnt, but you need to have the correct device name that's relevant on your system:
Code:
mount /dev/sdb1 /mnt -o umask=0
The umask option effectively tells the system to ignore permissions.

To check whether the usb is mounted, run the command: mount. The entry showing the usb device name should be near the end of the output if it's mounted.

One can write a test file to the mounted usb then, and then copy it back to the user's home directory to see if it works. For example:
Code:
touch testfile /mnt
cp /mnt/testfile ~

To unmount it, also as root run:
Code:
umount /mnt

It may be possible to mount the usb using the udisksctl command as user, for example:
Code:
$ udisksctl mount -b /dev/sdb1
Mounted /dev/sda1 at /media/ben/STORE N GO
Note that the udisksctl command outputs where the device has been mounted where it becomes available for reading and writing to and from.

To unmount the usb one runs:
Code:
udisksctl unmount -b /dev/sdb1

Note that when unmounting the usb, the user should no longer be in the directory of the mount point.

If none of the above works, then you might consider reformatting the usb. However, if you find that another usb, known to be good, also fails to mount with the above commands, then the problem may be elsewhere.

root@debian12:/home/username# mount /dev/sdb1 /mnt -o umask=0
mount: /mnt: special device /dev/sdb1 does not exist.
dmesg(1) may have more information after failed mount system call.

root@debian12:/home/username# udisksctl mount -b /dev/sdb1
Error looking up object for device /dev/sdb
 
Sometimes you have to be root, or at least sudo.

what is the output of
Code:
fdisk -l
 
Sometimes you have to be root, or at least sudo.

what is the output of
Code:
fdisk -l
though fdisk is installed and man fdisk works, all the other commands don't, it just says "bash: fdisk command not found"
 
Are you root? Did you sudo?

Try..

Code:
/usr/sbin/fdisk -l
yes im root, I already did su so all the commands are sudo, and also heres what comes up for that command:

bash: usr/sbin/fdisk: No such file or directory
 
Are you root? Did you sudo?

Try..

Code:
/usr/sbin/fdisk -l
okay, reinstalled fdisk and retried the command, heres what I got:

[sudo] password for username:
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: WD PC SN810 SDCPNRY-512G-1006
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: DF2138DF-0767-466A-A2B9-1A569E6010BF

Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1050623 1048576 512M EFI System
/dev/nvme0n1p2 1050624 998215679 997165056 475.5G Linux filesystem
/dev/nvme0n1p3 998215680 1000214527 1998848 976M Linux swap


Disk /dev/sda: 115.47 GiB, 123983626752 bytes, 242155521 sectors
Disk model: DataTraveler 3.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2a283129

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 242155519 242153472 115.5G 83 Linux
username@debian12:~$
 
So, it's saying your computer only sees two disks here.

/dev/nvme0n1: 476.94 GiB

and

/dev/sda: 115.47 GiB

There is no /dev/sdb. Are you trying to mount the 128GB usb drive?
 
In one post I saw /dev/sda and in another I saw /dev/sdb. Plug in the flash drive and use journalctl -xe to see what it says. See if it says the drive is read-only or write protected. Make sure your root file system is not read-only. The error message you posted made me wonder about this. I've never tried, as far as I know, to make my flash drives read-only. It is possible to make an ext4 system read-only before mounting so it will stay that way after mounting it. Do you know for sure what kind of file system is on the flash drive? Also, journalctl will tell you which special block device name the usb flash drive is using and information about the partitions.

Signed,

Matthew Campbell
 
So, it's saying your computer only sees two disks here.

/dev/nvme0n1: 476.94 GiB

and

/dev/sda: 115.47 GiB

There is no /dev/sdb. Are you trying to mount the 128GB usb drive?
yeah the 128 drive is the usb stick, i formatted it to work with linux a while ago, i forget the name for it ext4 or something.
 
In one post I saw /dev/sda and in another I saw /dev/sdb. Plug in the flash drive and use journalctl -xe to see what it says. See if it says the drive is read-only or write protected. Make sure your root file system is not read-only. The error message you posted made me wonder about this. I've never tried, as far as I know, to make my flash drives read-only. It is possible to make an ext4 system read-only before mounting so it will stay that way after mounting it. Do you know for sure what kind of file system is on the flash drive?

Signed,

Matthew Campbell
from the best of my memory the usb drive is ext4.
 
If your flash drive uses ext4 then you can toggle is read/write or read-only using tune2fs after using e2fsck, but only when it is not mounted.

Signed,

Matthew Campbell
 
If your flash drive uses ext4 then you can toggle is read/write or read-only using tune2fs after using e2fsck, but only when it is not mounted.

Signed,

Matthew Campbell
how do i do that? e2dsck and tune2fs
 
You don't need any of that stuff. It'll mount fine like it is.
The problem is, you're trying to mount /dev/sdb1 instead of /dev/sda1
Try this.

Code:
mount /dev/sda1 /mnt
 
You don't need any of that stuff. It'll mount fine like it is.
The problem is, you're trying to mount /dev/sdb1 instead of /dev/sda1
Try this.

Code:
mount /dev/sda1 /mnt
mount: /mnt: cannot mount /dev/sda1 read-only.
dmesg(1) may have more information after failed mount system call.

did this as sudo root superuser etc
 
how do i do that? e2dsck and tune2fs
Plug in your flash drive and use journalctl -xe to see what device name the drive is using. Then use e2fsck -fv /dev/sdb1 if it registers as /dev/sdb and you want to check partition 1. Adjust as needed. Then use tune2fs -O ^read-only /dev/sdb1 to turn off the read-only file system feature for /dev/sdb1. Once again, adjust the name and number as needed.

Signed,

Matthew Campbell
 

Members online


Top