12 Replies Latest reply on Apr 13, 2016 7:59 AM by DavidG

    Access Edison mass-storage from within Edison


      Hello everyone,


      Is there a way to access the disk space that appears as an USB drive when the Edison is plugged into a computer from within the Edison Linux system? I can't see it mounted anywhere and can't seem to find the files I upload there anywhere. I know I can use SSH to copy the files wherever I want, it's just very convenient to simply copy the files to the Edison drive on my laptop, I was hoping I could then grab them from the Edison command prompt somehow.


      Any clues?


      Thank you,


        • 1. Re: Access Edison mass-storage from within Edison

          Hi, I've attempted an answer to this very question here: https://communities.intel.com/message/253856#253856

          I'll paste it here for completeness....


          Here's how to get at the storage in the msdos partition.


          log into your Edison board over serial console or Wifi. If you're ssh-ing in over gadget rndis, you'll lose the connection because you have to unload the multifunction gadget. Here's the commands to make it available on your edison:


          rmmod g_multi

          mkdir /update

          losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update

          mount /dev/loop0 /update


          You  can now see the contents of the msdos partition in /update. And is writable, so you can put files in there.


          To reverse this, and make it available on your host machine:

          cd /

          umount /update

          modprobe g_multi

          then pull the usb cable and re-insert it, at which stage the disk should re-appear on your host machine.


          The reason for this is that you can't have two machines being the 'master' of the same partition at the same time, so you need to switch the owner. If it was NFS or Samba, the NFS or Samba process would always be in control. This case is different, as the g_multi driver allows the remote PC become the master, and cannot allow the Edison to also be writing to the disk at the same time.




          1 of 1 people found this helpful
          • 2. Re: Access Edison mass-storage from within Edison

            Hello, I have been using this solution for a while however after updating the firmware on my edison module I am getting an error a few seconds after rmmod g_multi successfully completes.  Is there some other service that also needs to be disabled in the lasted yocto image from intel?  I have an arduino board with a usb card attached and mounted everything else is configured as shipped.





            • 3. Re: Access Edison mass-storage from within Edison

              rather than using losetup you could also directly give an offset parameter to mount

              • 4. Re: Access Edison mass-storage from within Edison

                It is rmmod g_multi that causes the error.  By "succeeds" I mean it gives me the command prompt and lets me execute other commands, but the error shows up whether I run another command or not.  This only seems to occur when a PC is not connected to my Edison module through the OTG port.  Skipping the rmmod g_multi command allows me to mount the drive however will not let me umount if the rmmod command was not run initially (Device busy error on umount /update)




                • 5. Re: Access Edison mass-storage from within Edison

                  Just in case you were not aware, you cannot access the vfat from linux and the OTG port at the same time. When the OTG is connected and active, the partition is owned and rmmod will most likely fail on the linux side. Disconnect or unount the driver on the remote side first, then you can rmmod etc.



                  • 6. Re: Access Edison mass-storage from within Edison

                    Hello Dave,

                    I understand both Windows and Linux can't access or have the drive mounted at the same time.  Unfortunately the behaviour I am experiencing is the opposite of what you just described.  That is when I have the vfat connected to and mounted on my windows machine I can run rmmod, losetup, etc. The windows drive is automatically disconnected and I can successfully mount the vfat on my Edison's file system and umount, modprobe, and reconnect my PC without restarting the Edison.

                    It is when I don't have my PC connected to the vfat partition that I run into problems.  I cannot disable g_multi with the rmmod command and when I mount the drive (skipping rmmod) I can use the vfat space but cannot umount it and connect my PC without restarting my Edison.



                    • 7. Re: Access Edison mass-storage from within Edison



                      Following your steps, I was able to get Edison to see the partition containing the files from the mass storage device (MSD) area. However, I decides to play around a little with the commands you provided and got some weird behavior. Namely, I did what you suggested without removing the g_multi module from the yocto kernel.


                      I just ran, while I was able to see the MSD on my Win8 machine:


                      losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update\

                      mount /dev/loop0 /update


                      And it successfully mounted the device into /update and all the files where there as before. Using this, I tried a few things:


                      On the PC, made a new text file with some words in it and put it in the MSD:

                      - Edison couldnt see it (ie ls in the /update direction just resulted in the files present at the time of the mount)

                      - After unmounting the directory (umount /update) and mounting it again, the file appear, words and all.


                      On Edison, made a new text file with some words in it and put it in the MSD area (mounted /update)

                      - PC couldnt see it (refreshing the MSD yielded nothing but files there before)

                      - After unplugging and plugging Edison back in (reboot of Edison), the file appeared on the PC-side, words and all.

                      (Note: sync does nothing to make the file visible on PC)


                      So it seemed both sides could do a write to the partition while the other was present and get files to transfer back and forth (though it was annoying as the interface has to be reset to see the changes).


                      I lastly tried doing both at once, ie a new file on both sides: test1.txt created on Edison, test2.txt created on the PC

                      - Neither saw the other after creation as expected

                      - After interface was reset (unplug and plug back in), MSD on both sides contained only test2.txt (PC-created file), but its words were gone (empty file)


                      Im not a linux guru, so Im getting pretty confused by this behavior. Any insight into whats going on and why would be great. Thank!

                      • 8. Re: Access Edison mass-storage from within Edison

                        maybe relevant in this context:

                        a "mass storage device" can either be mounted on Windows or on Linux but not on both in parallel.

                        A write from an OS doesn't necessarily mean a file is actually written - it might be just in memory until it's flushed to disk.

                        A "MTP" device could be mounted on both in parallel afaik.

                        • 9. Re: Access Edison mass-storage from within Edison

                          getting this error when trying to follow the commands to access mass storage device


                          root@green:~# mount /dev/loop0 /update

                          mount: wrong fs type, bad option, bad superblock on /dev/loop0,

                                 missing codepage or helper program, or other error


                                 In some cases useful info is found in syslog - try

                                 dmesg | tail or so.


                          • 10. Re: Access Edison mass-storage from within Edison

                            I am trying to set up the mass storage device on UBILinux.  I have a few Edison boards and breakout boards and I had attempted on bot Windows 7 and Windows 10.  Following David Hunt's very clear instructions: http://dlsloan.ca/Docs/Edison/USBFileTransfer.html, I got the default Yocto Image to work: I can mount the USB Mass storage on either Windows (7) or from the Edison itself.

                            I need to use UBILinux for my initial project so I want to get it working there too.

                            I have another Edison board that I flashed with UBILinux without problem.  For fewer variables, I connected this Edison to the same Intel breakout board that I just used for the Yocto test Edison board, and I connected it to the same Windows 7 Laptop available USB ports.  The devices in device manager look different: In Ports: I do not see an

                            • Intel Edison Composite device
                            • Intel Edison Virtual Com Port.

                            I do see the USB Serial Port which is console.  In Other devices: I do see an unhappy RNDIS Device.

                            In windows disk management, I went to make the drive available and format it FAT (something I didn't have to do previously for Yocto) and I could then see it in Windows Explorer, and I made a text file for testing.


                            I then went to UBILinux and followed David's process mounting and unmounting the device.  I found that

                                 losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update

                            was not found.  I did find this though: 

                                 losetup -o 8192 /dev/loop0 /dev/disk/by-label/Edison 

                            However, when I go to mount, I get these errors:


                            mount /dev/loop0 /update

                            [  252.624807] EXT2-fs (loop0): error: can't find an ext2 filesystem on dev loop0.

                            [  252.632813] EXT4-fs (loop0): VFS: Can't find ext4 filesystem

                            [  252.639169] FAT-fs (loop0): bogus number of reserved sectors

                            [  252.645635] FAT-fs (loop0): bogus number of reserved sectors


                            Has anyone had similar experience?  What did you do to overcome the problem on UBILinux?

                            Thank you,


                            • 11. Re: Access Edison mass-storage from within Edison

                              I have the same error. Have you resolved this?

                              • 12. Re: Access Edison mass-storage from within Edison

                                No, I have not been working that issue.  It remains open.  My project has taken a different direction that does not involve need for this to be resolved.  I would love to resolve it though, but my work requirements have priority.