How does the Linux kernel decide if a block device gets the read-only flag set by default?

Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I have a USB stick which (for about 2 months) constantly gets mounted read-only. After a bit of research and testing I found out, that the block devices of the device itself (/dev/sdc) and one of the partitions (/dev/sdcX) always has read-only flags (cat /sys/block/sdc/ro and cat /sys/block/sdcX/ro is 1).
I'm not talking about mount options! I have to manually set the flag to 0 with hdparm -r0 /dev/sdcX to be able to mount the partitions as read-write and to write at them (yes, writing works) every time I plug in the USB stick and after a reboot. The USB stick has no read-only hardware switch. I already formatted the partitions, re-created the partition table and even did dd if=/dev/zero of=/dev/sdc to ensure that the old partition table gets destroyed completely, but nothing changed.
NOTE: Other devices however don't have this read-only flag set by default.
So how does the Linux kernel decide whether to set the read-only flag for a block device by default or not? And how can I change this behavior permanently and from early boot? (I actually boot my Raspberry Pi from this USB stick but the read-only behavior is the same on my laptop with different kernels...)?
mount kernel usb-drive block-device readonly
add a comment |Â
up vote
3
down vote
favorite
I have a USB stick which (for about 2 months) constantly gets mounted read-only. After a bit of research and testing I found out, that the block devices of the device itself (/dev/sdc) and one of the partitions (/dev/sdcX) always has read-only flags (cat /sys/block/sdc/ro and cat /sys/block/sdcX/ro is 1).
I'm not talking about mount options! I have to manually set the flag to 0 with hdparm -r0 /dev/sdcX to be able to mount the partitions as read-write and to write at them (yes, writing works) every time I plug in the USB stick and after a reboot. The USB stick has no read-only hardware switch. I already formatted the partitions, re-created the partition table and even did dd if=/dev/zero of=/dev/sdc to ensure that the old partition table gets destroyed completely, but nothing changed.
NOTE: Other devices however don't have this read-only flag set by default.
So how does the Linux kernel decide whether to set the read-only flag for a block device by default or not? And how can I change this behavior permanently and from early boot? (I actually boot my Raspberry Pi from this USB stick but the read-only behavior is the same on my laptop with different kernels...)?
mount kernel usb-drive block-device readonly
Might be related - askubuntu.com/questions/101637/usb-turn-write-protection-off
â slmâ¦
Aug 15 at 3:06
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I have a USB stick which (for about 2 months) constantly gets mounted read-only. After a bit of research and testing I found out, that the block devices of the device itself (/dev/sdc) and one of the partitions (/dev/sdcX) always has read-only flags (cat /sys/block/sdc/ro and cat /sys/block/sdcX/ro is 1).
I'm not talking about mount options! I have to manually set the flag to 0 with hdparm -r0 /dev/sdcX to be able to mount the partitions as read-write and to write at them (yes, writing works) every time I plug in the USB stick and after a reboot. The USB stick has no read-only hardware switch. I already formatted the partitions, re-created the partition table and even did dd if=/dev/zero of=/dev/sdc to ensure that the old partition table gets destroyed completely, but nothing changed.
NOTE: Other devices however don't have this read-only flag set by default.
So how does the Linux kernel decide whether to set the read-only flag for a block device by default or not? And how can I change this behavior permanently and from early boot? (I actually boot my Raspberry Pi from this USB stick but the read-only behavior is the same on my laptop with different kernels...)?
mount kernel usb-drive block-device readonly
I have a USB stick which (for about 2 months) constantly gets mounted read-only. After a bit of research and testing I found out, that the block devices of the device itself (/dev/sdc) and one of the partitions (/dev/sdcX) always has read-only flags (cat /sys/block/sdc/ro and cat /sys/block/sdcX/ro is 1).
I'm not talking about mount options! I have to manually set the flag to 0 with hdparm -r0 /dev/sdcX to be able to mount the partitions as read-write and to write at them (yes, writing works) every time I plug in the USB stick and after a reboot. The USB stick has no read-only hardware switch. I already formatted the partitions, re-created the partition table and even did dd if=/dev/zero of=/dev/sdc to ensure that the old partition table gets destroyed completely, but nothing changed.
NOTE: Other devices however don't have this read-only flag set by default.
So how does the Linux kernel decide whether to set the read-only flag for a block device by default or not? And how can I change this behavior permanently and from early boot? (I actually boot my Raspberry Pi from this USB stick but the read-only behavior is the same on my laptop with different kernels...)?
mount kernel usb-drive block-device readonly
mount kernel usb-drive block-device readonly
edited Aug 15 at 2:57
slmâ¦
238k65492662
238k65492662
asked Aug 14 at 23:22
CodingMarco
162
162
Might be related - askubuntu.com/questions/101637/usb-turn-write-protection-off
â slmâ¦
Aug 15 at 3:06
add a comment |Â
Might be related - askubuntu.com/questions/101637/usb-turn-write-protection-off
â slmâ¦
Aug 15 at 3:06
Might be related - askubuntu.com/questions/101637/usb-turn-write-protection-off
â slmâ¦
Aug 15 at 3:06
Might be related - askubuntu.com/questions/101637/usb-turn-write-protection-off
â slmâ¦
Aug 15 at 3:06
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462635%2fhow-does-the-linux-kernel-decide-if-a-block-device-gets-the-read-only-flag-set-b%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Might be related - askubuntu.com/questions/101637/usb-turn-write-protection-off
â slmâ¦
Aug 15 at 3:06