LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-26-2010, 02:26 PM   #1
ceazar123
LQ Newbie
 
Registered: Jun 2009
Location: India
Distribution: CentOS
Posts: 15

Rep: Reputation: 0
Read Write access to a iso9660 filesystem..mount a .iso image as read write


Hi Guys,

I have made a boot-able iso image which mounts vmlinuz and initrd.img into the RAM using initramfs. The initrd.img mounts a basic file system that takes me to a busybox shell.

From this shell, I run a small shell scripts that is as follows:

#!/bin/sh

echo Creating a mount point
mkdir /mnt
echo Mounting the Root File System
mount /dev/hdc /mnt ==> this mounts the iso image in the cd-rom to /mnt
echo changing Root
mount -o bind /proc /mnt/boot/proc/
mount -o bind /sys /mnt/boot/mnt/
export HOME=/root
chroot /mnt/boot

After this it boots fine, and I can see my file system that is loaded on my cd (.iso image). However, this is a read-only file system and I am not able to do anything.

I have already tried mounting a directory as tmpfs and binding a few directories to it, however it does not server my purpose.

So, I am stuck with a read only file system. Please can anyone point me to the right direction of create a read write on the file system.

Thanks and Regards,
-=Srijan
 
Old 08-26-2010, 03:11 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,747

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
After this it boots fine, and I can see my file system that is loaded on my cd (.iso image). However, this is a read-only file system and I am not able to do anything.
What is it you want to do?

Quote:
I have already tried mounting a directory as tmpfs and binding a few directories to it, however it does not server my purpose.
What is your purpose?

If you want to edit files in the .iso, or if you want to add files, you would have to mount the .iso, copy the files to a directory and make the directory read/write (recursively), then do your edits/file additions. After all that, remake the .iso.
 
Old 08-26-2010, 03:32 PM   #3
ceazar123
LQ Newbie
 
Registered: Jun 2009
Location: India
Distribution: CentOS
Posts: 15

Original Poster
Rep: Reputation: 0
Hi bigrigdriver,

Actually I have a CentOS Server, running 2.6.29. I have configured a small firewall, with iptables, snort_inline, zebra, keepalived etc. I wanted to make an iso image of my own distro, so that I can give it to my friends so that they can use a ready made Firewall.

To accomplish this, I created an initrd image using busybox that has an init file. The contents of the init file is:

#!/bin/nash

mount -t proc /proc /proc
setquiet
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mkdir /dev/shm
mount -o mode=0755 -t tmpfs /dev/shm /dev/shm
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/urandom c 1 9
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/root c 3 1
mknod /dev/hdc b 22 0
mknod /dev/sda b 8 0
mknod /dev/sda1 b 8 1
mknod /dev/root b 8 1
echo Setting up hotplug.
hotplug
echo Creating block device nodes.
mkblkdevs
echo "Loading ehci-hcd.ko module"
insmod /lib/ehci-hcd.ko
echo "Loading ohci-hcd.ko module"
insmod /lib/ohci-hcd.ko
echo "Loading uhci-hcd.ko module"
insmod /lib/uhci-hcd.ko
mount -t usbfs /proc/bus/usb /proc/bus/usb
echo "Loading scsi_transport_spi.ko module"
insmod /lib/scsi_transport_spi.ko
echo "Loading mptbase.ko module"
insmod /lib/mptbase.ko
echo "Loading mptscsih.ko module"
insmod /lib/mptscsih.ko
echo "Loading mptspi.ko module"
insmod /lib/mptspi.ko
echo "Loading usb-storage.ko module"
insmod /lib/usb-storage.ko
mkblkdevs
echo My Shell
/bin/sh

Along with the initrd.img and vmlinuz, I have made an iso image.

Once I boot the iso image, it gives me the busybox shell. However it is still in initramfs state. Then I try to mount the files in the iso to a /mnt directory and chroot to the environment according to this script:

#!/bin/sh

echo Creating a mount point
mkdir /mnt
echo Mounting the Root File System
mount /dev/hdc /mnt ==> this mounts the iso image in the cd-rom to /mnt
echo changing Root
mount -o bind /proc /mnt/boot/proc/
mount -o bind /sys /mnt/boot/mnt/
export HOME=/root
chroot /mnt/boot

Here, I cannot do much as the file system mounted is read only. I need a read write environment, so that I can get things modified and certain files that uses /var can write to it.

Thanks and Regards,
-=Srijan
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a iso filesystem read/write Korupt Linux - General 5 03-31-2009 09:13 PM
No write or read access to anything I mount Romanus81 Slackware 7 04-13-2008 07:19 AM
Mount ISO with read/write access the-yikes Slackware 3 08-06-2007 08:26 PM
Diskless node cant mount root NFS filesystem for read/write leontini Linux - Networking 0 01-31-2007 01:03 AM
Mount ISO Read/Write Johnsernickle Linux - Software 4 06-03-2005 03:19 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration