LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-10-2014, 02:43 PM   #1
dorsio
Member
 
Registered: Apr 2014
Distribution: Debian
Posts: 92

Rep: Reputation: 1
Remounting as read-write a directory on device


How to remount as read-write a target directory on device? (one folder) I need to replace file, which is in "Read-only file system", not allow to change permissions. Path to folder: /etc/foo/bar. I need to remount /bar folder. Embedded Linux (busybox), Linux version 2.6.18_pro500

I tried the following, with no success:
Code:
<root@elocal:/etc/foo/bar> ls -la
total 6
drwxr-xr-x    2 root     0               98 Jan 18  2011 .
drwxrwxr-x    7 root     0              105 Feb 10  2011 ..
-rw-r--r--    1 root     0             1052 Jan 18  2011 file1
-rw-r--r--    1 root     0              270 Jan 18  2011 file2
-rw-r--r--    1 root     0             1088 Jan 18  2011 file3
-rw-r--r--    1 root     0              270 Jan 18  2011 file4

mount -o rw,remount /etc/foo/bar
mount: can't find /etc/foo/bar in /proc/mounts
output mount command:
Code:
mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
proc on /proc type proc (rw)
ramfs on /var type ramfs (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock4 on /nvram type jffs2 (rw)
output of cat /proc/mounts
Code:
cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / squashfs ro 0 0
proc /proc proc rw 0 0
ramfs /var ramfs rw 0 0
sysfs /sys sysfs rw 0 0
tmpfs /dev tmpfs rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/mtdblock4 /nvram jffs2 rw 0 0
 
Old 08-10-2014, 03:09 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
From the output you have shared I don't see any filesystem mounted on /bar. You don't mount directory, you mount filesystem on a directory. Also, the command that you have tried (though it will not work in this case as I don't see any filesystem mount on /bar) is incorrect. Correct syntax is:

Code:
mount -o remount,rw /filesystem
From what I can gather from your post you are trying to edit a file and you are unable to do so as it says read only file. I would suggest checking file permission as well as attributes using:

1. ls -al filename_or_directory_name
2. lsattr filename
 
Old 08-10-2014, 03:26 PM   #3
dorsio
Member
 
Registered: Apr 2014
Distribution: Debian
Posts: 92

Original Poster
Rep: Reputation: 1
File attributes specified in my sample code Nr 1 (-rw-r--r--)

you mean this
mount -o remount,rw /squashfs

Last edited by dorsio; 08-10-2014 at 03:33 PM.
 
Old 08-10-2014, 03:28 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Run lsattr against any of these file and paste the output. Syntax: lsattr <filename>
 
Old 08-10-2014, 04:27 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Is "squashfs" the filesystem type? squashfs is inherently read-only. To make changes, you would need to install squashfs-tools, then unpack the filesystem (unsquashfs) into a directory tree somewhere writeable, make your changes, and mksquashfs a new filesystem.

More generally, while you can bind-mount a directory to a new mount point, you cannot gain any features that were not in the original mount. If the filesystem is mounted read-only, the bind-mount will also be read-only. See the "--bind" option in the mount command.
 
Old 08-10-2014, 05:03 PM   #6
dorsio
Member
 
Registered: Apr 2014
Distribution: Debian
Posts: 92

Original Poster
Rep: Reputation: 1
Thanks for clarifying.

Last edited by dorsio; 08-10-2014 at 05:11 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] usb drive: cannot remount block device /dev/sdb1 read-write, is write-protected schneidz Linux - Hardware 5 01-06-2015 03:15 PM
read/write in block device driver zali Programming 4 05-05-2012 03:14 AM
Fooling The System That A Read-Only Device Is Read-Write Woodsman Slackware 34 08-26-2009 07:45 PM
Fedora core 3 apparently not remounting root filesystem read-write during boot amundsen_eric Fedora 3 05-17-2005 05:46 AM
RH9 "remounting root filesystem in read-write mode" ChrisHax Linux - Newbie 3 07-23-2004 09:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:07 PM.

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