LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 02-22-2017, 08:28 PM   #1
Glenn D.
Member
 
Registered: May 2009
Location: ACT - Australia
Distribution: Opensuse x86_64 (Latest)
Posts: 132

Rep: Reputation: 26
How do I make read-only file system writable?


How do I make read-only file system writable?

using opensuse
Thanks
--Glenn

steps done so far:

# mount /dev/sdb /media/disk

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 1.8T 747G 1.0T 43% /media/disk

# id
uid=0(root) gid=0(root) groups=0(root)

# ll /media/disk
ls: cannot access /media/disk/nvidia-installer.log: No such file or directory
ls: cannot access /media/disk/opensuseurl.txt: No such file or directory
ls: cannot access /media/disk/packman.txt: No such file or directory
ls: cannot access /media/disk/q1.txt: No such file or directory
ls: cannot access /media/disk/q1.txt~: No such file or directory
ls: cannot access /media/disk/read-only,txt: No such file or directory
ls: cannot access /media/disk/remove.txt: No such file or directory
ls: cannot access /media/disk/repos.txt: No such file or directory
ls: cannot access /media/disk/rpmlist.log: No such file or directory
ls: cannot access /media/disk/to-remove: No such file or directory
ls: cannot access /media/disk/x: No such file or directory
ls: cannot access /media/disk/zgl: No such file or directory
ls: cannot access /media/disk/lost_name_2a:73746200000000:3f1ed: No such file or directory
ls: cannot access /media/disk/pub_linux_utils_fs_reiser4_libaal.html: No such file or directory
total 180
drwx------ 4 root root 4 Sep 5 15:42 .Trash-0
lrwxrwxrwx 1 root root 55 Jul 5 2009 NVIDIA-Linux-x86_64-185.18.14-pkg2.run -> nvidia/laptop-7x/NVIDIA-Linux-x86_64-185.18.14-pkg2.run

drwxr-xr-x 2 root root 863 Feb 22 2010 packages
drwxr-xr-x 5 root root 14 May 14 2011 packman
?????????? ? ? ? ? ? packman.txt
drwxr-xr-x 3 root root 4 Aug 11 2009 partitioning
drwxr-xr-x 7 root root 17 Nov 3 2009 phoronix
drwxr-xr-x 2 root root 3 Mar 15 2011 pictures
drwxr-xr-x 3 root root 4 Sep 23 2009 plugins
?????????? ? ? ? ? ? pub_linux_utils_fs_reiser4_libaal.html
?????????? ? ? ? ? ? q1.txt
?????????? ? ? ? ? ? q1.txt~
?????????? ? ? ? ? ? read-only,txt
?????????? ? ? ? ? ? remove.txt
?????????? ? ? ? ? ? repos.txt
drwxr-xr-x 3 root root 4 Jan 25 2010 rpm-description
drwxr-xr-x 4 root root 8 Sep 23 2009 rpm-help
?????????? ? ? ? ? ? rpmlist.log
drwxr-xr-x 2 root root 22 Jul 22 2010 rpms-old
drwxr-xr-x 2 root root 4 Jun 3 2011 sharon
?????????? ? ? ? ? ? to-remove
?????????? ? ? ? ? ? x
?????????? ? ? ? ? ? zgl
drwxr-xr-x 2 root root 6 Jul 20 2011 zz-iso


# echo zzzzzzzzzz >/media/disk/zjunk.txt
bash: /media/disk/zjunk.txt: Read-only file system


#
 
Old 02-22-2017, 09:03 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,784

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
The filesystem on that disk is damaged, and the kernel will refuse to make it writable until it has been repaired by fsck. Judging from what you have shown, fsck might result in losing a lot of data. If that data is important, you should use ddrescue to copy as much of the image as can be recovered to a new 2TB (or larger) disk drive before you play with it.
 
Old 02-22-2017, 10:26 PM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Fix the filesystem. Although read-only so you can fix it while "using" it, semi-safely. Otherwise push the I'm feeling lucky button. Systemd will default to read-only for / if / isn't listed in /etc/fstab.

$ sudo mount -o remount,rw /

Where / is the mount point that is (ro,...) in the output of mount without parameters, that you want to change.

$ mount
 
Old 02-23-2017, 08:30 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,784

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
As soon as the kernel detects an error in the filesystem it will be remounted read-only again. There is an "error behavior" field in the filesystem super block. It is typically set to "remount-ro". You can use tune2fs to change it. The other options are "continue" and "panic". Changing it to "continue" is not recommended. Writing to a corrupted filesystem is like using a rotary lawnmower in a meadow where there are cow droppings. Cr*p gets spread around and makes the problem much worse.
 
Old 02-23-2017, 09:14 AM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Do what the others have suggested would be better.

modded due to mis understanding of question

Last edited by BW-userx; 02-23-2017 at 01:26 PM.
 
Old 02-23-2017, 09:42 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,784

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Quote:
Originally Posted by BW-userx View Post
To just answer the question in the header.
Code:
chmod 666 / -R
File permissions have absolutely nothing to do with a "Read-only filesystem" error. And anyway, attempting to change permissions on such a filesystem would just fail with a "Read-only filesystem" error.
 
Old 02-23-2017, 11:13 AM   #7
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,346

Rep: Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552
Quote:
Originally Posted by BW-userx View Post
To just answer the question in the header.
Code:
chmod 666 / -R
If you do that you will make all of your programs not executable.

----------------------------------
Steve Stites
 
Old 02-23-2017, 11:56 AM   #8
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,607

Rep: Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108Reputation: 4108
@BW-userx, you seem to have formed a pattern of posting snide, sarcastic and off-topic remarks in a variety of threads. This isn't acceptable at LQ. Please refrain from this behavior moving forward. If you have any questions, feel free to contact a mod or myself privately. Thanks.

--jeremy
 
2 members found this post helpful.
Old 02-23-2017, 12:06 PM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by rknichols View Post
File permissions have absolutely nothing to do with a "Read-only filesystem" error. And anyway, attempting to change permissions on such a filesystem would just fail with a "Read-only filesystem" error.
To just answer the question in the header.
 
Old 02-23-2017, 12:14 PM   #10
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
I would suggest censoring/removing that chmod command from this thread as it is very dangerous and destructive and wrong. A beginner might happen upon it and run it. I'm reporting it as such to the mods.

Last edited by szboardstretcher; 02-23-2017 at 12:15 PM.
 
Old 02-23-2017, 12:16 PM   #11
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by BW-userx View Post
To just answer the question in the header.
shouldn't you have done... (and NOBODY RUN THIS)

.c.h.m.o.d. ugo+w / -R

still a terrible idea to actually run of course but at least you can actually do things in directories and don't lose all of your executes on all of your commands. Of course this doesn't fix a certain issue I once had to deal with where somebody did (ANOTHER ONE TO NEVER RUN)

c.h.a.t.t.r. +i /

Needless to say I think this has gone off topic enough now.

Last edited by r3sistance; 02-23-2017 at 01:16 PM. Reason: making things more clear
 
Old 02-23-2017, 12:26 PM   #12
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
It seems that many have seen my answer and not my recommendations to same said answer, beginner or not one has to learn this eventually. that being so then when? the person then will always be in the dark about that command, then perhaps one day find out the hard way, by actually doing that to his or her system.

I explicitly said
"But I'd not recommend that."

which then raises a question.

why not?

which promotes what?

thinking.
which does what, especially if one asks more questions or seek the answers to these questions?
gains knowledge.

If one keeps treating a child as a child he will always act like a child.
If one treats a child like an adult (within that child limits) he will become an adult.

and even adults act like children sometimes, that is called regression.


How some people love to take things out of content so they can fire up their torches and scream burn him burn him...

Last edited by BW-userx; 02-27-2017 at 04:53 PM.
 
Old 02-27-2017, 01:32 AM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,078

Rep: Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364Reputation: 7364
just one additional comment:
on a read-only filesystem the chmod command will not do anything but fail.
 
Old 02-27-2017, 08:14 AM   #14
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,702
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
"Gentlebeings, let us stay 'on point' here ..."

Another situation where you can encounter a read-only filesystem is when you boot a "rescue" DVD or USB-stick, and when you boot into single-user mode. The file system, although undamaged, might be initially be purposely mounted Read/Only so that it requires a conscious act ("remounting it") to subject its content to change. (Think: "the safety on a gun.")
 
Old 02-27-2017, 09:41 AM   #15
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by rknichols View Post
The filesystem on that disk is damaged, and the kernel will refuse to make it writable until it has been repaired by fsck. Judging from what you have shown, fsck might result in losing a lot of data. If that data is important, you should use ddrescue to copy as much of the image as can be recovered to a new 2TB (or larger) disk drive before you play with it.
Glenn - if, in fact, there is damage to the file system on the medium in question, the above-quoted recommendation is the best one so far, in my opinion, for the reason mentioned by rknichols. I wouldn't recommend any other file-system repair commands until you have made an image of the disk with ddrescue.

Best of luck !

Last edited by Rickkkk; 02-27-2017 at 11:38 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make read-only root partition writable again? aranea.network Linux - Desktop 2 09-13-2016 04:49 AM
Mount a writable directory in a read-only file system? leetwanker Linux - Newbie 1 01-19-2014 03:54 AM
Writable compressed file system avtandil_k Linux - Newbie 2 03-30-2010 06:06 PM
[SOLVED] Make the root file system read-only on RHEL 5.3 ursusca Linux - Security 17 11-28-2009 04:18 PM
How to make root file system be read-only? Completely Clueless Linux - Security 10 04-19-2009 06:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration