Mass Storage mode + loop device fun


Yoyobuae

Very Active Member
Joined
Oct 23, 2009
Messages
839
Ok here is the scenario: You just downloaded some OS to install on a PC, but there's no CD/DVDs available to burn. There's also no available USB flash drives or SD cards that can be completely wiped to put the ISO in them because they have info and would be annoying to backup/restore them. But you have your Pandora handy. So what do you do?

Here's what I did :) :

  • Copied ISO image file to Pandora SD (ext4 formatted even)
  • Create a loop device backed by the ISO image (sudo /sbin/losetup /dev/loop0 /1p/some.iso)
  • Use modified mass storage mode script (attached) to expose created loop device via USB (sudo ./op_storage_loop.sh /dev/loop0)
  • Connect Pandora via USB to PC
  • Boot from ISO image via Pandora and install OS :D
Maybe someone had already found this before, I personally was really surprised how well it works.

One can have several disk images in SD card formatted with whatever filesystems (ie. NTFS, etc) and expose them via USB when needed. It is no longer necessary to format one SD card with some specific FS to use USB mass storage with specific PCs (ie. Windows).

The Pandora itself can create the (empty) disk image in SD card if necessary (ie. via dd and mkfs commands) and even mount the image to copy stuff to/from it (sudo mount -o loop some.iso /some/dir). The image can even be formatted from a PC when connected via USB (ie. for NTFS).

op_storage_loop.zip
 

Attachments

  • op_storage_loop.zip
    726 bytes · Views: 275
Last edited by a moderator:
Nice idea. Does it work for something besides Linux (or BSD)? Windows?
 
Last edited by a moderator:
Very cool, and such a coincidence, that I found myself in this very situation today right before I checked this topic (no usb-sticks or cd's at hand and need to install a distribution on my PC)

Must try this later, but I still have to backup the PC HDD before I install anything to it. :p
 
Neat.

There is another project, dunno if the same technique is used:

http://boards.openpandora.org/topic/10202-iso-optical-drive/

Btw i plan to integrate this into SOLEIL sometime.
Oh that's sweet. Yes it is the same technique.

That works even better because CD/DVDs ISOs work directly. I was copying the ISO contents to an NTFS partition image to get it to work, but that's unnecessary if cdrom=1 parameter is used.
Don't be sure about that, many problems were reported. Just check the thread.

Maybe your method is better.

You should link your thread on the other one btw.
 
Last edited by a moderator:
Don't be sure about that, many problems were reported. Just check the thread.

Maybe your method is better.

You should link your thread on the other one btw.
Seems the only unsolved problem is booting from ISO as external CD drive.

Booting from ISO as external USB drive works just fine though. And making a booteable USB drive from an ISO image is quite easy (ie. make booteable partition and copy over contents of ISO, or use some tool for making booteable USB drives).

The only other difference with my method is using a loop device. But it seems this is unnecessary (can pass the ISO file to g_file_storage).

So I haven't really contributed anything new. :lol:
 
Last edited by a moderator:
Back
Top