Link to home
Start Free TrialLog in
Avatar of pvinodp
pvinodp

asked on

how to edit a file in a mounted file system in LINUX

I have a iso image in /exports/ under linux.
I mounted it to /exports/softImage/ using mount  -o loop  <iso file>   <target directory>.
Now in a subfolder under that target-directory i want to edit a file. When i try to save the file after editing it i get the error E212: Cant open file for writing
when i press df -ah to see how th efile system is configured:
/exports/myiso file        148M 148M    0 100%    /exports/softImage
Avatar of pvinodp
pvinodp

ASKER

If I try to change the permission of the file system [/exports/softimage] or the particular file i get this error Read only file system
Remount the filesystem as read-write (it will affect your ISO though).

mount -o remount,rw /exports/softImage

Open in new window


Then back read-only

mount -o remount,ro /exports/softImage

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of medvedd
medvedd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of farzanj
I tried the same thing a few months back.

You have to copy all the contents, edit the file you want and recreate the ISO again.

I didn't like this solution, but apparently this is the only way it can be done-- as I found after a lot of research.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to make a copy of the entire iso file system. Then make your changes. Then create a new iso image using mkisofs.
The following commands will make a copy of softimage in your home directory (you may want to put it elsewhere - adjust the below commands to suit)
mkdir ~/softimage_copy
cd /exports/softimage
tar -cf - . | tar -C ~/softimage_copy -xpUf -

Open in new window

Avatar of pvinodp

ASKER

Thanks for the solution