Using removeable media with Linux

USB memory stick

(Zip/CDROM/Floppy/USB memory sticks)

IMPORTANT NOTES

You must remember to unmount device before attempting to remove it otherwise your data may be lost - Linux does not necessarily write data to the media immediately and as such a copy command may continue to happen in the background after it has returned on the command line. When you perform an unmount, any data that is still pending is written to the device. This is especially important for floppy disks and memory sticks.

Accessing data on removeable media

Centos 5 should handle the mounting of media such as USB or cd-rom automatically- when you insert a disk or usb device you should see an icon appear on your desktop. It should also be available through the Nautilus file-browser and in the /media directory on the command line.

Unmounting media

You should umount media before attempting to remove it. You can do this by right-clicking on any icon that has appeared for your device and selecting the 'unmount' option, or by using the umount command. For example to umount a cdrom:
    dcs-002% umount /media/myusbstick
    dcs-002%

Note that you will not be able to umount the device if you have a window or shell prompt cd'd to the mount point or if data is being read from the device, for example:
    dcs-002% cd /media/myusbstick
    dcs-002% ls -al
    total 38
    drwxr-xr-x    3 root     root         2048 Sep 10 2002 .
    drwxr-xr-x    7 root     root         1024 Oct 9 09:55 ..
    -rw-r--r--    1 root     root           75 Sep 10 2002 .discinfo
    -rw-r--r--    3 root     root         6194 Sep 10 2002 EULA
    -rw-r--r--    3 root     root        18385 Sep 10 2002 GPL
    -rw-r--r--    3 root     root         5350 Sep 10 2002 README
    drwxr-xr-x    3 root     root         2048 Sep 10 2002 RedHat
    -rw-r--r--    3 root     root         1910 Sep 10 2002 RPM-GPG-KEY
    -r--r--r--    1 root     root          291 Sep 10 2002 TRANS.TBL
    dcs-002% umount /media/myusbstick
    umount: /media/myusbstick: device is busy
To solve this, you would need to cd to another directory and then retry the umount command.

It is also possible to umount CDROMs and Zip disks automatically by using the eject command, eject cdrom or eject zip, again this will not work if the device is currently in use.

Do not attempt to remove the CD by forcing the drive - doing so will damage the CD drive. You should also not attempt to use a paperclip to eject a CD - if the software eject command does not work, then the disk is probably still spinning. You should instead contact a member of the support team who will retrieve the disk for you.

The floppy disk is already mounted?

If you try to mount a floppy disk and are told it is already mounted, this is probably because a previous user removed the disk without unmounting it. To solve this, you first need to unmount the floppy disk and then mount it again.