# Using the Perstel DR201 under Linux

## Requirements

- Linux kernel 2.4 or later with support for the usb-storage driver.
  - If you are unsure what kernel version you are using, type the command `uname -r` at a terminal prompt.
  - If you use your distribution's 'minimal' kernel, or have compiled your own kernel, it may not include the usb-storage driver. This product requires the usb-storage driver.
  - This device is currently not supported under the 2.6 kernel series.

## Installation

- Create a "mount point" where the files on the device will appear.
  - When logged in as the system administrator (the `root` user, in a terminal window, type `mkdir /dr201`
- Plug the player into a USB port, ensuring that it is set to music play mode.
- Check that the usb-storage driver has been loaded.
  - Use the command `/sbin/lsmod` and look for a line containing `usb-storage`.
- Now 'mount' the device, to map the files on the device to the mount point.
  - Use the command `mount -t msdos /dev/sda1 /perstel`
  - If you have used another USB mass storage device previously, the DR201 may not appear as `/dev/sda1`. The second mass storage device plugged in is called `/dev/sdb1`, the third `/dev/sdc1` and so on. If you are unsure which device the DR201 was mapped to, the `dmesg` command may detail this.
  - Use of the `vfat` instead of the `msdos` filesystem is not recommended. Use of it may cause your DR201 to malfunction.
- You can now edit the files in `/perstel`. Any changes you make to this directory will be saved to your DR201.
  - `cp example.mp3 /perstel` will upload the file `example.mp3` to the device.
  - `rm /perstel/example.mp3` will remove the file `example.mp3` from the device.
  - `cp /perstel/example.mp3 ~` will copy the file `example.mp3` from the device to your home directory.
  - `df -h /perstel` will detail the space used and available on the DR201.
- Before unplugging your DR201, it must be 'unmounted'. This finalizes any changes you have made and prepares the device for removal.
  - Use the command `umount /mnt/perstel`
  - The command may take up to ten minutes to complete, whilst the files are syncronized. This is normal.
  - Removing the DR201 without unmounting, or before unmounting has completed, can cause the device to lose data or malfunction.
- Once the unmounting command has completed and the terminal printed another command prompt, the DR201 can be safely unplugged.

## Repair

If an error occurs whilst uploading and downloading files to the DR201, the device can be left in an inconsistent state, and possibly malfunction as a result. If this occurs, you can try to repair or reformat the DR201's internal memory.

- To repair the DR201's memory

- With the device in music play mode, plug it into the PC.
- While logged in as `root`, use the following command in a terminal window: `fsck.msdos -r`
- The command will ask you to confirm repairing of any errors it finds.
- When the command has completed, the device may be unplugged.

- If the device's memory cannot be repaired, it may be possible to reformat
  - Reformatting the DR201 erases any files that are stored on it
  - With the device in music play mode, plug it into the PC.
  - While logged in as `root`, use the following command in a terminal window: `mkfs.msdos /dev/sda1` (if you use other USB mass storage devices, please see the details on device names above).
  - When the command has completed, the device may be safely unplugged.

## Troubleshooting

- When I plug the device in, `lsmod` does not list a loaded usb-storage driver.
  - Ensure that the driver for your computer's USB is loaded. This is usually listed by `lsmod`, and on most computers are called `uhci`, `ohci` or ehci.
  - Make sure the driver database is up to date. At a `root` terminal prompt, use the command `depmod -A`
- I receive the error `mount: /dev/sda1 is not a valid block device`
  - The device has not been mapped to the first device name. You can use the `dmesg` command to find out what device name the DR201 has been allocated - for example:

        SCSI device sdc: 129024 512-byte hdwr sectors (66 MB)
        sdc: test WP failed, assume Write Enabled
         sdc: sdc1

    means that the device has been allocated `/dev/sdc1`.
- When unmounting the DR201, I receive the error `umount: /perstel: device is busy`
  - Make sure you have none of the files in the `/perstel` directory open, and that no terminal windows are in that directory, and then try again. This error means that the directory or a file within it is still in use.