[SOLVED] What makes a usb stick from Read write -> read only
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What makes a usb stick from Read write -> read only
I am having Endeavorous linux KDE "can't write configuration file" issue.
Hence doing some manual copy of data from from /home to a usb drive.
I created a folder on the usbstick on the problematic laptop and transferred some data over 1 time, then paste it to a desktop.
Plugged the same usbstick the 2nd time on the same problematic laptop, wanted to create another folder to do data transfer again.. but this time it said :
Code:
mkdir: cannot create directory 'folder': Read-only file system
Why did it changes mounting of my usbstick to read-only file system instead of normal Read-write file system ? What made the decision ?
I have to do :
Code:
sudo mount -o remount,rw '/run/media/user/usbstick'
so that it changes mounting to Read-write file system .
Only after this i can create a new folder in the usbstick.
My question is why it changes ? What causes it to change ? is this the same thing that causes my current issue "can't write configuration file" ?
What are you using to mount that usb device? Are you un-mounting it before you remove it? Does user have full mount permissions. Are you mounting as user or root? What kind of permissions does user have? Are you using an auto mounter?
Quote:
My question is why it changes ? What causes it to change ?
How do you have your box setup? Are you pulling it out without umounting it, sticking it in again and getting a new device node which is read only?
A common reason for that error is a corrupt filesystem which can sometimes be repaired. First thing we would need to know is what filesystem is on the usb drive. Also answering all the questions in post 2 will provide helpful information.
In your other thread, you indicate that you were having problems editing a configuration file with vi, When you edited it the first time, did you close the file properly?
My practice here has always been to
1. start with a Linux format on the usb stick — less likely to cause trouble
2. if it goes read-only, use fsck
3. if it does it again, reformat
4. if it happens for the third time, dump it.
Well, you learn something new every day. My mp3 player, when inserted into the pc, sometimes does not allow deletion of files or does not allow transfer of files. So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
Well, you learn something new every day. My mp3 player, when inserted into the pc, sometimes does not allow deletion of files or does not allow transfer of files. So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
Yes, of course. The kernel saves up disk writes in its buffers to do when it's not particularly busy. If you don't unmount a plug-in device properly, it gets out of sync.
So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
Depends on the file system how much trouble you'll have doing that.
Even on a windows machine, with a external ntfs volume, you are suppose to click on that icon in the taskbar, "remove drive safely", before you pull it out, or it'll do it's checkdisk the next time you stick it in. And windows can fix it's own file system just fine. On a linux machine you need to make sure it is unmounted before removing, or it won't mount again. And ntfs-tools probably won't help.
Not something that you should do on purpose but, you can pull a FAT or EXT4 drive out in the middle of a write and it won't hurt it, other than the file that you were copying will be corrupt. But you'll have a hung mount. You'll probably need to do a force umount. That is what mount and df are for.
What are you using to mount that usb device? Are you un-mounting it before you remove it? Does user have full mount permissions. Are you mounting as user or root? What kind of permissions does user have? Are you using an auto mounter?
How do you have your box setup? Are you pulling it out without umounting it, sticking it in again and getting a new device node which is read only?
I plugged the usb stick in, it auto mounted (default). I don't need to mount it.
I do not unmount usb stick, just when it is no doing data transfer, just unplug it. I always do that, never a problem before. I also do that to my manjaro kde desktop, no problem what so ever.
A common reason for that error is a corrupt filesystem which can sometimes be repaired. First thing we would need to know is what filesystem is on the usb drive. Also answering all the questions in post 2 will provide helpful information.
In your other thread, you indicate that you were having problems editing a configuration file with vi, When you edited it the first time, did you close the file properly?
Yes, i always close vim properly (for the sake of my data ). That computer is seriously wrong.. somewhat..
The filesystem on the usb drive that i asked in this thread is actually liveusb from Endeavorous. I was borrowing the space to do 1 file transfer from problematic Endeavourous laptop to manjaro desktop. Never a problem on Manjaro.. but on the laptop with Endeavorous os.. the problem occurs.
My practice here has always been to
1. start with a Linux format on the usb stick — less likely to cause trouble
2. if it goes read-only, use fsck
3. if it does it again, reformat
4. if it happens for the third time, dump it.
I see, that would indicates usbstick got issue.. but my usbstick is fine on manjaro Desktop.. it only occurs on endeavorous laptop.
Well, you learn something new every day. My mp3 player, when inserted into the pc, sometimes does not allow deletion of files or does not allow transfer of files. So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
I don't think you need to unmount it before unplug, if this is a must than there is no proud of saying linux is better than window os. I unplug straight away from manjaro desktop, no problem what so ever.. just make sure you stop doing data transfer for a short while, at least.
Depends on the file system how much trouble you'll have doing that.
Even on a windows machine, with a external ntfs volume, you are suppose to click on that icon in the taskbar, "remove drive safely", before you pull it out, or it'll do it's checkdisk the next time you stick it in. And windows can fix it's own file system just fine. On a linux machine you need to make sure it is unmounted before removing, or it won't mount again. And ntfs-tools probably won't help.
Not something that you should do on purpose but, you can pull a FAT or EXT4 drive out in the middle of a write and it won't hurt it, other than the file that you were copying will be corrupt. But you'll have a hung mount. You'll probably need to do a force umount. That is what mount and df are for.
Oh really ? I have always unplug usb stick while not writing. never problem before.. it still mount each time. I tried many time on the same usb stick, it mounts fine.. ya.. eject before unplug is always the best practice.
I plugged the usb stick in, it auto mounted (default). I don't need to mount it.
I do not unmount usb stick, just when it is no doing data transfer, just unplug it. I always do that, never a problem before. I also do that to my manjaro kde desktop, no problem what so ever.
With the current level of USB drive handling, IF the drive is synced and not actively involved in writing data you can usually unplug it without actively dismounting it and systemd will handle that for you. If there is activity on the drive, or even if you have the file manager with a folder open on that device and you unplug it problems can occur. That is why the file manager has an icon to dismount those devices before you remove then. Better to take action and prevent problems than to try and repair what gets barfed up.
And you said the problem occurs on the endeavorous laptop. That is a different OS than the manjaro desktop so you have to expect the software may not be the same and it apparently does not handle unplugging a USB without dismounting it the same way.
Learn the differences and practice what works on the most restrictive one always; so you don't forget and cause yourself problems.
Last edited by computersavvy; 05-27-2021 at 10:36 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.