Sharing Files Between Ubuntu Flash Drive and Windows

How to Share Files Between your USB Ubuntu Flash Drive install and Windows. In the following tutorial, you will learn how to modify the casper script to allow you to mount your USB Flash Drive as read/write. By default casper only allows the root user to gain full access to the drive, preventing the live user from saving files back to the fat formatted device. This tutorial allows for the default Ubuntu user to also have the same read and write access.

Upon completion, you will be able to save files back to the root of your Flash Drive (mounted as /cdrom) while your running from Ubuntu. Save your documents, photos, movies, mp3's, special configuration files etc… back to the Flash drive. In addition you can add files while running from Windows and then access those files again while running from Linux or vice versa.

The following solution should work on Ubuntu, Kubuntu, Linux Mint, and other "Ubuntu 11.10/11.04/10.04/10.10". based compilations.

Updated 2/19/2012 Now works with Ubuntu 11.10

Edit the Casper script to allow read and write access to the entire USB device:

  1. Boot from your previously created USB Ubuntu Flash Drive
  2. Open a terminal and type sudo su (to become root)
  3. Type mkdir /projectaccess (to make our project directory)
  4. Type cd /projectaccess (to change to the project directory)
  5. Type lzma -dc -S .lz /cdrom/casper/initrd.lz | cpio -id (to extract the initrd.lz)
  6. Type gedit scripts/casper (to edit the casper script)
  7. From gedit, find the following section of code:

    home_snapshot_label="home-sn"

  8. Just below it add the following code:

    mountmode="ro,noatime"

  9. Now for 10.04 or 10.10, find the following section of code:

    IGNORE_UUID="Yes" ;;

    Or if using 11.04 or 11.10 find the following section of code instead:

    UUID="" ;;

  10. Just below it add the following code:

    basemountmode=*)
    mountmode="${x#basemountmode=}";;

  11. Now find the following section of code:

    if is_supported_fs ${fstype}; then

  12. and (as a single line of code) change the first occurrence of mount line to:

    mount -t ${fstype} -o ${mountmode} "${devname}" $mountpoint || continue

  13. Save the file and return to the open terminal
  14. From the terminal type find . | cpio -o -H newc | gzip -9 > initrd.lz (to zip the new initrd.lz file)
  15. Type cp initrd.lz  /cdrom/casper
  16. Type gedit /cdrom/syslinux/txt.cfg ( text.cfg if using Ubuntu 10.04)
  17. On the first append line, replace the following section:

    initrd=/casper/initrd.lz

  18. With the following section (as a single line):

    initrd=/casper/initrd.lz basemountmode=ro,noatime,uid=999,gid=999

  19. Save the file and exit the editor
  20. Reboot your computer and proceed to boot from your USB Flash Drive again

If all goes well, you should now be able to save files to /cdrom (the root of your Flash Drive) from within Ubuntu and access those files from within Linux or Windows.

Kudos goes out to Julian Chennales who submitted the base information for this fix to pendrivelinux for posting.

Ubuntu is a product of Canonical Ltd.

Similar Portable Linux Posts:

  • No Similar Portable Linux Posts Detected
Disclaimer