Mounting a second .img file

Help
John Cowan
2012-02-24
2013-04-23
  • John Cowan
    John Cowan
    2012-02-24

    I screwed up my Pubuntu disk.  I saved my old rootfs.img file at C:\cygwin\opt\userfs.img (just because it was handy)have created a new rootfs.img file, and it boots fine.  Now I want to connect that .img file to Pubuntu's /dev/cobd2.  I have tried these lines (only one at a time) in the portable_ubuntu.conf file, but they do not work:

    cobd2="C:\cygwin\opt\userfs.img"

    file_system2="C:\cygwin\opt\userfs.img"

    I get told inside Linux that /dev/cobd2 does not exist, even though the file is there in /dev.  What's the Right Thing here?

    If it matters, I am using V4.

     
  • John Cowan
    John Cowan
    2012-02-24

    I also tried this without the quotation marks.  No joy.

     
  • bob_wh
    bob_wh
    2012-02-24

    I tried mounting 3 image files on my copy of V4 and they mounted okay and I can access the files.  I specifically tested file_system2 to see if I can read the files and I could.  The setup that I used is the following:

    pubuntu.conf:

    ## Raw filesystem images or partitions of disk (in Windows format). cobdX are image of
    ## filesystem. Also you can specify the type of filesystem.

    #file_system0=some_drive:\path\some\file_system.img
    file_system0=F:\P_Ubuntu\Portable_Ubuntu_V4\images_old\oldrootfs.img
    file_system1=F:\P_Ubuntu\Portable_Ubuntu_V4\Debian\rootfs_2gb.img
    file_system2=M:\Download\OSS_Software\Colinux\RootImagesFromColinux\ArchLinux-2007.08-2-ext3-256m\ArchLinux-2007.08-2-ext3-256m.fs


    On the linux side after booting:

    pubuntu@pubuntu:~$ df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/cobd0             5161536   3444312   1457720  71% /
    /dev                    119640       244    119396   1% /dev
    none                    119640        24    119616   1% /dev/shm
    none                    119640        76    119564   1% /var/run
    none                    119640         0    119640   0% /var/lock
    none                    119640         0    119640   0% /lib/init/rw
    cofs0                 34352608  29057460   5295148  85% /usr/local/pubuntu
    cofs1                 41980648  30206928  11773720  72% /tmp/pubuntu
    /dev/cobd2             3818656   2536864   1087808  70% /media/cobd2
    /dev/cobd3             2719520   2092380    488912  82% /media/cobd3
    /dev/cobd4              253871     99376    141388  42% /media/cobd4
    cofs2                 41980648  30206928  11773720  72% /media/cofs2

    Portable_ubuntu_info file in the temp directory:

    swap=1
    cdrom=1
    for_fstab="/dev/cobd2##F:\P_Ubuntu\Portable_Ubuntu_V4\images_old\oldrootfs.img"
    for_fstab="/dev/cobd3##F:\P_Ubuntu\Portable_Ubuntu_V4\Debian\rootfs_2gb.img"
    for_fstab="/dev/cobd4##M:\Download\OSS_Software\Colinux\RootImagesFromColinux\ArchLinux-2007.08-2-ext3-256m\ArchLinux-2007.08-2-ext3-256m.fs"
    for_fstab="cofs2#cofs#c:\"
    pulseaudio=1
    network_mode=slirp
    host_ip=10.0.2.2
    display=10.0.2.2:0.0

    Have you tried starting with filesystem0 as the first mount?  The quotes are not needed.  I don't see anything wrong with your config.  Maybe there is something wrong with the image you are trying to mount.  Did you get any error message on the console?

    -Bob

     
  • John Cowan
    John Cowan
    2012-02-25

    Thanks, bwheater.  I added this line to portable_ubuntu.conf (not pubuntu.conf, there is no such file) in the Portable_Ubuntu_V4_slim2\config directory on the Windows side:

    file_system2=C:\cygwin\opt\userfs.img(ext3)

    and booted Pubuntu.  Here's what I see on the Linux side:

    root@pubuntu:~# more /tmp/pubuntu/portable_ubuntu_info
    swap=1
    cdrom=1
    for_fstab="/dev/cobd2#C:\cygwin\opt\userfs.im#C:\cygwin\opt\userfs.img(ext3)"
    for_fstab="cofs2#cofs#c:\"
    pulseaudio=1
    host_ip=10.0.2.2
    display=10.0.2.2:0.0
    root@pubuntu:~# ls -l /dev/cobd2
    brw-rw--- 1 root disk 117, 2 2012-02-25 00:33 /dev/cobd2
    root@pubuntu:~# cat /dev/cobd2
    cat: /dev/cobd2: No such device
    root@pubuntu:~# grep cobd2 /etc/fstab
    root@pubuntu:~# ls -l /media/cobd2
    total 0
    root@pubuntu:~#

    So the portable_ubuntu_info file is being updated, and there is a device file in /dev, but there's nothing connected to it, and /etc/fstab is not updated either.  The /media/cobd2 directory exists because I created it there.

    So I ran e2fsck on the image file from the Windows side:

    e2fsck 1.40.6 (09-Feb-2008)
    The filesystem size (according to the superblock) is 8388608 blocks
    The physical size of the device is 0 blocks
    Either the superblock or the partition table is likely to be corrupt!
    Abort<y>? no

    c:\cygwin\opt\userfs.img contains a file system with errors, check forced.
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    c:\cygwin\opt\userfs.img: 306326/2072576 files (3.6% non-contiguous), 1949219/83
    88608 blocks

    The initial error is apparently normal: the clean rootfs.img file also reports a physical size of 0.  So it's not that the filesystem image is corrupt.

    I'm at a loss here.

     
  • bob_wh
    bob_wh
    2012-02-25

    >(not pubuntu.conf, there is no such file) in the Portable_Ubuntu_V4_slim2\config
    That is what happens when you try do it from memory instead of looking up the actual file name.
    The original developer uses "portable_ubuntu" and "pubuntu" at various points in the code.

    >file_system2=C:\cygwin\opt\userfs.img(ext3)
    Have you tried it with the "(ext)" removed?

    >root@pubuntu:~# more /tmp/pubuntu/portable_ubuntu_info
    >…
    >for_fstab="/dev/cobd2#C:\cygwin\opt\userfs.im#C:\cygwin\opt\userfs.img(ext3)"
    >for_fstab="cofs2#cofs#c:\"

    Apparently the code is parsing the filesystem type incorrectly. 
    The line in the info file should be:

    for_fstab="/dev/cobd2#ext3#C:\cygwin\opt\userfs.img"

    The second field between the # delimiters should be the filesystem type.

    Apparently, the orginal code did not specify the fields to use properly after it
    called the function "StringSplit".

    Its best not to specify filesystem type since the code seems to be broken.

    -bob

     
  • John Cowan
    John Cowan
    2012-02-26

    Success!  Removing the filesystem type turned out to be the  Right  Thing.  Thank you so much.