AIX系统使用USB闪存设备

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

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.
Memory sticks are useful in my opinion because:
They are ideal for fast data access.
They can be used in data transfer where network performance is poor.
They are great for scratch or temporary file systems.
They are cheaper than other alternatives.
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. Mounting a USB stick(挂载USB设备)
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 bif.08025002.rte
Fileset Level State Type Description (Uninstaller)
bif.08025002.rte
7.1.0.15 A F USB Mass Storage Device
Software
# lslpp -L b.rte
FilesetLevel State Type Description (Uninstaller)
b.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
It is also shown in the devices output:
# lsdev |grepusb(列出所有USB接口的设备)
usb0 Available USB System Software
usbhc0 Available 08-08 USB Host Controller (33103500)
usbhc1 Available 08-09 USB Host Controller (33103500)
usbhc2 Available 08-0a USB Enhanced Host Controller (3310e000)
usbms0 Available 2.1 USB Mass Storage
For AIX 5.3, the first USB device is shown as flashdrive0.
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设备添加文件系统)
# mkfs -V jfs2 -o ea=v2 /dev/usbms0
mkfs: destroy /dev/usbms0 (yes)?
File system created successfully.
3927736 kilobytes total disk space.
Device /dev/usbms0:
Standard empty filesystem
Size: 7855472 512-byte (DEVBLKSIZE) blocks
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.
For AIX 5.3, there is no NOLOG option in the mount command.
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(建立挂载点)
# mount -o log=NULL /dev/usbms0 /usb_mnt(挂载USB设备)
# df -g |grepusb
/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:(建立带日志的文件系统)
# mkfs–olog=INLINE,ea=v2 –Vjfs2 /dev/usbms0
mkfs: destroy /dev/usbms0 (yes)?
logform: Format inline log for <y>?y
File system created successfully.
3912376 kilobytes total disk space.
Device /dev/usbms0:
Standard empty filesystem
Size: 7824752 512-byte (DEVBLKSIZE) blocks
# mkdir /usb_mnt
# mount -V jfs2 -o log=/dev/usbms0 /dev/usbms0 /usb_mnt
Unmounting a memory stick
Once you have finished using the a USB stick file system, unmount it, remove it, then delete the usbms0 device:
# umount /usb_mnt(卸载挂载的USB设备)
# rmdev -dl usbms0(将USB设备在系统中移除)
Mounting a previous initialized memory stick
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.。

相关文档
最新文档