Mounting a second .img file

John Cowan
  • 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:



    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:


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


    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:


    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?


  • 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:


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

    root@pubuntu:~# more /tmp/pubuntu/portable_ubuntu_info
    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

    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.

    Have you tried it with the "(ext)" removed?

    >root@pubuntu:~# more /tmp/pubuntu/portable_ubuntu_info

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


    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.


  • John Cowan

    John Cowan - 2012-02-26

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


Log in to post a comment.