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
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
Remount the filesystem as read-write (it will affect your ISO though).
Then back read-only
mount -o remount,rw /exports/softImage
Then back read-only
mount -o remount,ro /exports/softImage
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
Please checkout my question a few months ago
https://www.experts-exchange.com/questions/26685553/Writing-on-ISO-image.html
https://www.experts-exchange.com/questions/26685553/Writing-on-ISO-image.html
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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)
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 -
ASKER
Thanks for the solution
ASKER