How to remount .img as rw and repack


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to remount .img as rw and repack
# 1  
Old 09-19-2012
How to remount .img as rw and repack

Hi fellas!
I make a sh script which the following:
Code:
sudo mkdir Temp
sudo mount -o loop output.img Temp

The command mounts the img.Thats fine.But it moun s it as read only.But I need to edit/delete some files inside it and repack it as ext4 using this command:
Code:
sudo ./mkuserimg.sh -s Temp factoryfs.img ext4 ./temp 893386752B

The part I'm lacking is,How do I remount the .img as rw and edit the files inside that???
And yeah...I need to remount the partition again with the default permissions again after editing/deleting files....
Thanks for your help...

---------- Post updated 09-19-12 at 11:42 AM ---------- Previous update was 09-18-12 at 02:42 PM ----------

Bump!!!Please guys..Some help on this...Smilie
# 2  
Old 09-19-2012
I don't think this can be done. You can look at iso images as archives of sort, and can't modify it. Mounting just makes it accessible, but the archive is set.
What I'd do is copy the mounted filesystem tree somewhere else (provided you have enough space), then make the changes and then make the new iso image.
# 3  
Old 09-20-2012
Quote:
Originally Posted by mirni
I don't think this can be done. You can look at iso images as archives of sort, and can't modify it. Mounting just makes it accessible, but the archive is set.
What I'd do is copy the mounted filesystem tree somewhere else (provided you have enough space), then make the changes and then make the new iso image.
Any Ideas on how to do this???
Edit:I tried this but got errors on chown part....
Code:
mkdir extracted
sudo cp -rfv TempDir/* extracted
user=$user
sudo chown -R $user extracted


Last edited by vijai; 09-20-2012 at 05:15 AM..
# 4  
Old 09-20-2012
What did you try to achieve with this line?
Code:
user=$user

I'd bet $user is not set. You probably want to do any of these equivalent ways to get the current user:
Code:
chown -R $USER extracted
chown -R $(whoami) extracted
chown -R $(id -un) extracted

This User Gave Thanks to mirni For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Os not coming up after i set mount -o remount,rw /dev/hda8

on RHEL 5.3 i did mount -o remount,rw /dev/hda8 ( this is /tmp directory ) now OS not coming up. How to resolve ?? ---------- Post updated at 04:57 PM ---------- Previous update was at 03:36 PM ---------- one of my friend told me that you have changed sticky bit permissions on /tmp... (6 Replies)
Discussion started by: rehantayyab82
6 Replies

2. UNIX for Advanced & Expert Users

Could I get the initrd.img file without recompile the kernel?

Hi, all: The vmlinuz-3.0.4.old is a kernel previous to the current running kernel vmlinuz-3.0.4 which is compiled the most currently. Could I get the initrd.img-3.0.4.old without recompile under the condition that the config-3.0.4.old, System.map-3.0.4.old and vmlinuz-3.0.4.old exist? if it... (1 Reply)
Discussion started by: liklstar
1 Replies

3. UNIX for Dummies Questions & Answers

.IMG file help!!!

I've been trying to create an IMG file for the past week with no success. I've tried using: dd if=/dev/zero of=myimage.img bs=512 count=2880 mke2fs myimage.img mkdir /media/mount_point mount -o loop myimage.img /media/mount_point cp -aR <file> /media/mount_point umount /media/mount_point ... (30 Replies)
Discussion started by: neur0n
30 Replies

4. UNIX for Advanced & Expert Users

Remount filesystem

Hi all, i don't know why, but a filesystem of my server is in read only ( / ). I try to do a "mount -o remount / " but it answer me: mount: block device /dev/VolGroup00/LogVol00 is write-protected, mounting read-only Do you know why? Thanks in advance. (3 Replies)
Discussion started by: Zio Bill
3 Replies

5. Red Hat

Fedora installation getting stuck in initrd.img

I have a 80GB hard disk with WinXP already installed.I had tried installing Fedora 10 earlier without creating new partitions(real foolish and ignorant of me :o:o ) and tried creating partitions using Fedora10 bootable.It didnt work.Then I created a free partition and again tried installing... (4 Replies)
Discussion started by: ganesh.k28
4 Replies

6. Solaris

Read/View .img files from SunOs 5.8

We use imaging software from a cardiology clinic on SunOS 5.8 and I want to be able to see these image files (.img extension) on Windows XP. Can this be done? If so, with what software (on Windows XP)? On Windows XP, I've used software like Ulead PhotoImpact and Corel PhotoPaint but I've had no... (16 Replies)
Discussion started by: sreyes27
16 Replies

7. Solaris

remount not working

HI All, I am trying to remount a file system using teh remount option as belwo; gws210i122: mount -o remount /tmp mount: Operation not supported But i am getting the error as mentioned. Please suggest. Regards, Sag. (3 Replies)
Discussion started by: sag71155
3 Replies

8. UNIX for Advanced & Expert Users

.DSK to .IMG ?

Hi, I have a windows emulator that I am wanting to try out, but my Windows 3.1 files are split up over 6 .DSK images, and I need to convert them to an .IMG that I can actually mount on my system (so that the emulator can see it). Is there a way to do this? thanks. -patrick (0 Replies)
Discussion started by: patrick99e99
0 Replies

9. Programming

getting img url

hey, i just found this forum...how cool. question: does anybody know code or know where i can get the code to get a certain image URL from user? say user input URL from shell prompt when run the program. What is the code to take that URL open internet and download the image. thanks alot. (2 Replies)
Discussion started by: bb00y
2 Replies
Login or Register to Ask a Question