How to Use U Disk under Linux and FreeBSD

Time:2019-9-15

How to Use U Disk under Linux/FreeBSD

1. First of all, we need to know a concept: any storage device with USB interface can be regarded as a U disk, which includes USB external hard disk, CF card with USB interface, MMC card and so on.
  
2. Under Linux/FreeBSD, the U-disk unification is simulated as SCSI hard disk. When the U-disk is plugged into the computer, it can pass through:
/ dev/sda, / dev/sdb…. (Under Linux)
/ dev/da0s1, /dev/da0s2…. (under FreeBSD)
Correspond to U disk
  
3. Because of the different versions and settings of Linux (Kernal)/FreeBSD, the USB driver module can be attached to the system.
  
Can be different, so we recommend that you use RedHat version 7.2 or more (referring to the kernel version), FreeBSD version 4.7 or more.
After the U disk is inserted, use the following commands to load the U disk:
  
3.1 Firstly, a U-disk portal directory is established under / mnt.
mkdir /mnt/usbdsk
  
3.2 Then load:
mount -t msdos /dev/sda1 /mnt/usbdsk (Linux)
mount -t msdos /dev/da0s1 /mnt/usbdsk (FreeBSD)
  
4. Some U-disks have a virtual boot/antivirus floppy disk. When plugged in, two SCSI hard disks will appear in the system, such as / dev/sda, / dev/sdb. Then you need to choose the device node when mounting. If your U-disk is not in FAT16 format, you need to change the – t parameter.
  
5. I personally use a 64MB MMC card (on Siemens 6688), FAT16 format, and plug ThinkPad through the MMC to USB connector.
At present, my system is FreeBSD 4.7 (mini installation). When I plug in, the system prompts me to find the SCSI disk and then pass through it.
Mount-t msdos/dev/da0s1/mnt/usbdsk.
  
6. The driver modules needed for U disk can be loaded dynamically. Under Linux, they are usb-storage.o, scsi_mod.o and sd_mod.o. Usually, the new version of Linux will load these modules by default, without your manual operation. I am not sure about the corresponding modules under FreeBSD, but the principle is the same.
If you have to load the driver module module manually, first find the specific location of the three files mentioned above (different Linux distributions are different), and then load them with modprobe, for example:
/lib/modules/2.4.18-14/kernel/drivers/usb/storage/modprobe -r usb-storage.o

My FreeBsd test passed