PGTS PGTS Pty. Ltd.   ACN: 007 008 568

point Site Navigation

point Other Blog Threads



  Valid HTML 4.01 Transitional

   Brilliant XED lighting!
   Australian XED Lighting

   AXL

   Australia/NZ Distributor of
   Reming XED Lighting Products






PGTS Humble Blog

Thread: Open Source Software

GP JPG
When in doubt, tell the truth. -- Mark Twain

Using MTOOLS with USB drives


Chronogical Blog Entries:



Date: Thu, 28 Jan 2010 14:58:49 +1100

MTOOLS is a very useful suite of commands which are essential for copying, modifying or manipulating data on floppy disks, and other PC-DOS format disks. These commands can also be very handy for manipulating data on USB drives, which are usually FAT (or vfat) format. Those of you who used the classic PC-DOS command line, will remember a crippled command line with great upper body strength like a strange hunchback. Now with MTOOLS you can combine that classic command line with the dazzling, lean and muscular power of the Unix command line. A deadly combination if you're not afraid of typing a few simple commands for your Linux bash interpreter. Here is how you get MTOOLS working with USB drives in Kubuntu

First, if you haven't done it already, you must install MTOOLS:

sudo apt-get install mtools

If you use floppy disks and the command line, that would have been the first command that you ran on your new Kubuntu workstation.

In order to find out the device names of your USB ports, just plug them into one of the front panels on your computer. If you have a standard Kubuntu distribution, KDE will auto-mount a device when you select "Open with Dolphin" in the device window. After this you can them find out the device name by entering the command "mount" in a Konsole window. On my system, I see the following after plugging in a USB drive to the right-most port.

/dev/sdc1 on /media/KINGSTON type vfat (rw,nosuid,nodev,uhelper=hal,uid=1001,utf8)

After you have the device name, eject it (in the device window).

Next, edit mtools.conf

sudo vi /etc/mtools.conf

And add two lines like the following:

# Front RHS USB port
drive d: file="/dev/sdc1"

Make sure that you are in the "disk" group. You can add yourself to this group by using the "usermod" command. If you feel a little WIMPish you can use the Kuser menu (Applications->System->User Manager)

NB: If you already have used an MTOOLS program, and you add yourself to the "disk" group you must re-boot in order for the changes to flow through. (I think MTOOLS might start some daemon the first time it is run).

Now you should be able to use the full suite of MTOOLS commands on your USB drive. You can copy between floppies, NFS mounts, Linux partitions, etc.

You will need a line in /etc/mtools.conf for each USB port.

Read about the many MTOOLS commands by entering "man mtools".

Some example commands:

# clear a label on a USB drive:
mlabel -c d:
# change the label on a USB drive to "Fred"
mlabel d:Fred
# Delete the folder ".Trash-1002"
mdeltree d:.Trash-1002
# copy all MIDI files from floppy disk to the "midi" folder (USB drive):
mcopy a:*.MID d:/midi/
# find every recent youtube file on an NFS mount and copy it to the USB drive:
find /foo/bar -name '*.flv' -mtime -2 -exec mcopy {} d:/youtube/ \;

Other Blog Posts In This Thread:

Copyright     2010, Gerry Patterson. All Rights Reserved.