User Tools

Site Tools


The original documentation on this topic can be found on this html doc page on the site.

Exchanging files with USB sticks

USB mass storage support will be mainline soon for the Beaglebones. Not for the beagleboard or x86 targets for the foreseeable future.

The next section describe preparing a stick to exchange files between Minix and Linux. In the first example, the stick is prepared on Minix. In the second example, the stick is prepared on Linux.

“In both cases a new partition table is written onto it, thereby destroying all data previously on it.”

From Minix to Linux

To prepare a USB stick on Minix to be read on Linux, we can use the Minix filesystem. We will show you in this example.

Insert the USB stick in the Minix target and clear its partition table. Then start part. You will see something like this:

Started driver /service/usb_storage with label usb_disk8 for device 8.
New USB disk at /dev/usb_disk8.

# dd if=/dev/zero of=/dev/usb_disk8 count=1
1+0 records in
1+0 records out
# part /dev/usb_disk8

The part screen then looks like:

# part /dev/usb_disk8

  Size in kilobytes   ----first----  --geolast--  ------sectors-----
    Device             Cyl Head Sec   Cyl Head Sec      Base      Size        Kb
    /dev/usb_disk8                          64  32
                         0    0   0   979   63  30         0   2007039   1003519
Num Sort   Type
 0*  p0  81 MINIX        0    1   0   978   63  31        32   2004960 M:1002480
 1   p1  00 None         0    0   0     0    0  -1         0         0         0
 2   p2  00 None         0    0   0     0    0  -1         0         0         0
 3   p3  00 None         0    0   0     0    0  -1         0         0         0

Type '+' or '-' to change, 'r' to read, '?' for more help, 'q' to exit

Move the cursor to where the M: is written (I put it there just to specify the location) and press the 'm' key, for 'magic.' This will 'do the right thing' in most cases in part. In this case it will make a new partition for you in the desired slot with the MINIX type with the right offset and size to fill the whole stick.

Then press 'w' to write the new table.

You don't really need this partition for Minix, but other operating systems may be surprised to find just a single filesystem on a device without a partition table.

The new device is addressed by /dev/usb_disk8p0.

Then write a filesystem on it and create a file there:

# mkfs.mfs /dev/usb_disk8p0
# mount /dev/usb_disk8p0 /mnt
# echo hello world >/mnt/hello.txt
# umount /dev/usb_disk8p0

Done! Now stick the stick into a Linux computer and mount it there:

# mount /dev/sdb1 /mnt
# cat /mnt/hello.txt
hello world
# umount /dev/sdb1


From Linux to Minix

This example will do the same thing but initialize the USB stick from Linux and use an ext2 filesystem.

Again, first wipe the stick clean. We will use /dev/sdb as an example.

“Please be CAREFUL to replace /dev/sdb in the following with the stick device name, as it will be destroyed”

# dd if=/dev/zero of=/dev/sdb count=1

Partition the stick using gparted.

# gparted /dev/sdb

In parted, create a partition table by choosing the 'device' menu, 'create partition table,' select the 'msdos' partition type, then 'apply.'

Then press '+' to create a partition.

Select the ext2 filesystem type; ok, add it.

Then click the checkmark in gparted to commit these operations.

gparted will create the partition and format it with an ext2 filesystem.

Mount it:

# mount /dev/sdb1 /mnt
# echo hello world >/mnt/hello.txt
# umount /dev/sdb1


Now, insert the stick in Minix. And mount the partition using ext2. You will see something like:

Started driver /service/usb_storage with label usb_disk2 for device 2.
New USB disk at /dev/usb_disk2.

# mount /dev/usb_disk2p0 /mnt
/dev/usb_disk2p0 is mounted on /mnt
# ls -al /mnt
total 56
drwxr-xr-x   3 root  operator   4096 Aug 25  2014 .
drwxr-xr-x  18 root  operator   1408 Jan  1 00:22 ..
-rw-r--r--   1 root  operator     12 Aug 25  2014 hello.txt
drwx------   2 root  operator  16384 Aug 25  2014 lost+found

# cat /mnt/hello.txt
hello world

There we go!

usersguide/osdataexchange.txt · Last modified: 2014/11/11 08:52 (external edit)