AIX系统使用USB闪存设备
AIX系统使用USB闪存设备
In this article, I will demonstrate how to create a USB memory stick file system (hereafter called
USB stick) I am using AIX 7.1 with a 4GB Sandisk memory stick. These USB sticks can come in sizes
up to 256GB.
The only downside is that they do have a limited life in that the write cycles on these drives
typically last around 8-10 years, before the memory cells wear out. But as they are cheap to buy,
this is really not a concern as you would no doubt replace them within that time period anyway.
The AIX 6.1 documentation states that it supports the following branded USB sticks:
Sandisk
Lenovo
Kingston
However, I have used other branded and non-branded USB sticks with no issues found.
Be sure to have the correct fileset(s) installed before inserting your USB stick. The following file-
sets are required to access a USB stick:(先确定 USB 设备驱动包是否安装)
# lslpp -L devices.usbif.08025002.rte
Fileset Level State Type Description (Uninstaller)
devices.usbif.08025002.rte
7.1.0.15 A F USB Mass Storage Device
Software
# lslpp -L devices.common.IBM.usb.rte
Fileset Level State Type Description (Uninstaller)
devices.common.IBM.usb.rte
7.1.0.15 A F USB System Software
Insert the USB stick and run cfgmgr to discover it:(插入 USB 闪存设备)
# cfgmgr (刷新硬件设备)
Once discovered, you have two devices (the block and raw device):
ls -l *usbms0
cr--r--r-- 1 root system 44, 0 Aug 22 18:59 rusbms0
br--r--r-- 1 root system 44, 0 Aug 22 18:59 usbms0
At this point, I could treat the USB stick as a raw volume and write data to it. However, in this
demonstration, I will mount the USB stick as a file system. I feel there is no need to create a log
device for this USB mount, since the purpose of a scratch file system is that it is temporary and
thus speed is of the essence when transferring data. To create the USB stick file system use the
following command:(给 USB 设备添加文件系统)
The previous command initialized the USB stick. Select "Yes" to destroy, or rather initialize, the
device. The file system type is of jfs2 type. I do not believe that a type of jfs2 really matters for
this task, as the file system is not going to use the jfs2 log device. But as this is the norm when
creating file systems, I created it as a jfs2. To ensure the file system is scalable, I specify that with
the 'ea' option. In this example, the device to use is the USB stick inserted, which is usbms0.
Next, mount the file system specifying that is it to be mounted without a log device; be sure to
create the directory it is to be mounted on first:
# mkdir /usb_mnt(建立挂载点)
# df -g |grep usb
/dev/usbms0 3.75 3.73 1% 4 1% /usb_mnt
If you wish to use a log device to mount the usb stick, use the inline log. This ensures that it is
contained within the file system:(建立带日志的文件系统)
Once you have finished using the a USB stick file system, unmount it, remove it, then delete the
usbms0 device:
If you are in possession of a memory stick that contains data what was previously mounted as a
file system, to access it simply mount it. Be sure to create the mount point first. For example,
assume the USB device is inserted in the second USB slot, then have the device discovered as
usbms1:
# mkdir /usbstick
# mount -o log=NULL /dev/usbms0 /usbstick
Back to top
Conclusion
Using USB sticks is a great when you want to create a fast read access scratch file system for
processing or maybe a raw device to dump some files into for transport to another AIX system.
USB sticks offer one solution where you have a poor network, and you need to get a large
amount of data transferred.