Thursday, September 17, 2009

[QnA] Test: USB stick mounting

This should be a fundamental issue, but I've had no idea how to mount a USB stick manually. It's convenient to let the system auto-mount the USB stick, but it's also make me feel unsatisfied. I just want to mount the device by myself!

PART I. To Mount It

1.1 Identify the device

So I start to find some information and to test the manual mounting with my USB stick. The first thing needed is to find out which device stands for my Sony USB stick.

$ sudo fdisk -l

I used the fdisk command before and after I plugged the USB stick, then from the differences of output message I know the /dev/hdb1 stands for my USB stick. Then I tried to mount it by typing

$ sudo mount /dev/hdb1 /media/sonyusb

and got ``mount: mount point /media/sonyusb does not exist.'' I searched the reason and found that I have to create the /media/sonyusb before I mount anything to it. At the same time, I recalled that everything in Linux is treated as a file, including a device.

1.2 Make a folder for the mounting

$ sudo mkdir /media/sonyusb
$ sudo mount /dev/hdb1 /media/sonyusb

This time I mounted the USB stick, but when I listed the files inside it, some filenames contained Chinese characters showed question marks. I guess this was about unicode or something like that. To solve this problem, I found the option ``iocharset=ustf'' can make it.

1.3 Use iocharset to show unicode filenames correctly

$ sudo mount /dev/sdb1 /media/sonyusb/ -o iocharset=utf8

With the option, I can mount my Sony USB stick succesfully without any problem! :-)

PART II. Some More Tests

After knowing how to manually mount the USB stick, I continued to test something. Here are some results.

2.1 Unmount conflict between CLI and GUI

If the USB stick has been mounted by sudo command in the CLI, then an error message will pop up when you try to unmount the mounted device.

Therefore, if you mount the device via CLI manually, just unmount it also in command line.

2.2 Remove the folder after unmount

After the USB stick has been unmounted, the mounting point (i.e. the previously created folder) won't be removec automatically. If you want to delete the mounting point, it can be remove manually.

No comments:

Post a Comment