Log in

No account? Create an account

Josh-D. S. Davis

Xaminmo / Omnimax / Max Omni / Mad Scientist / Midnight Shadow / Radiation Master

Previous Entry Share Next Entry
GEEKY: HOWTO: JFS2 on USB device on AIX
Logo IBM AIX 3.2.5
So far, IBM says you cannot mount a USB mass storage device. I wanted to test this out a bit.

I bought a Belkin F5U219 USB adapter for a whopping $12 including shipping. I plugged it in, then LO AND BEHOLD! It is detected by the IBM PCI USB2 drivers.

Then, I upgraded to latest via suma. Now, my two USB 80G WD SATA drives are detected as usbms0 and usbms1.

There are block devices, but no character devices. This means no TSM volumes on the raw device, but what about filesystem access?

AIX does not call these hdisks. They are "USB Mass Storage" devices. As such, they cannot presently be a part of your LVM. No PPs, no LPs, no striping, mirroring, concatenating, rootvg booting, etc.

Also, AIX does not know how to handle, nor even look for a partition table on USB devices. mtools expects to see a partition device, not a disk device. As such, your FAT filesystem will not be accessible through AIX.

However, you don't NEED LVM for a mounted filesystem. Just as you can put a filesystem on a ramdisk, you can put one on any random access storage device. If you're willing to clobber the whole device, you can do this:
# mkfs -olog=INLINE,ea=v2 -Vjfs2 /dev/usbms1
mkfs: destroy /dev/usbms1 (yes)? y
logform: Format inline log for <y>?y
File system created successfully.
77816244 kilobytes total disk space.
Device /dev/usbms1:
Standard empty filesystem
Size: 155632488 512-byte (DEVBLKSIZE) blocks
# mkdir /usb1
# mount -V jfs2 -o log=/dev/usbms1 /dev/usbms1 /usb1
# df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 262144 161420 39% 6295 5% /
/dev/hd2 3932160 512436 87% 52989 6% /usr
/dev/hd9var 262144 160548 39% 5542 9% /var
/dev/hd3 3407872 2968652 13% 246 1% /tmp
/dev/hd1 262144 253432 4% 39 1% /home
/proc - - - - - /proc
/dev/hd10opt 1310720 265876 80% 25523 8% /opt
/dev/fslv00 25165824 10337756 59% 38 1% /tsm
/dev/scrlv 78643200 75589416 4% 904 1% /scratch
/dev/usbms0 78125000 77806612 1% 4 1% /usb0
/dev/usbms1 78125000 77806612 1% 4 1% /usb1
Excellent. I wrote to it, unmounted, remounted, and the file was still there.

"But, but but, we didn't use LVM! I don't want to mount this manually every time I boot!" NO PROBLEM. Manually edit the /etc/filesystems and add these 2 entries:
        dev             = /dev/usbms0
        vfs             = jfs2
        log             = INLINE
        mount           = true
        options         = rw

        dev             = /dev/usbms1
        vfs             = jfs2
        log             = INLINE
        mount           = true
        options         = rw
        account         = false
OK, great, but what about this "USB 1.1 performance only" thing?
# time dd if=/dev/zero of=/usb0/test1g bs=256k count=4k
4096+0 records in.
4096+0 records out.

real 0m57.68s
user 0m0.08s
sys 0m13.40s
So on my wimpy, 2-way 375MHz 7044-260, it writes 142 mbit/sec to the device using 23.2% CPU (half of one CPU). This is a far cry from the 480 mbit/sec limit of USB 2.0, but it definitely exceeds USB 1.1's limit of 12 mbit/sec.

Great, that sounds usable. What if I want to move the device?
# umount /usb0
# rmdev -l usbms0
unplug the cable
plug it into the new system
# cfgmgr -l usb0
mount or /etc/filesystems as before
I have a 1TB drive to test out. I'm anticipating it will get substantially more than 142mbit/sec.

If you needed RAID, mirroring, or striping, you could use an eSATA port expander (about $100) to merge up to 5 drives into one device (JBOD, RAID0, RAID1, RAID5). Keep in mind that you're still limited to 480mbit (60mbyte) per second per USB controller, with an effective speed of 320mbit (40mbyte) per second due to USB sof/eof timing.

Suffice it to say that if you're willing to do a little but of manual work for the set-up, it's very usable.

  • 1

USB2 effective speed limits

Effective rate reaches at 40MBps or 320Mbps for bulk transfer on a USB 2.0 hard drive with no one else is sharing the bus. Flash Drives seem to be catching up too with the some hitting 30MB/s milestone. For all we know, USB interface could become become the bottleneck for flash drives as early as 2008.

Additional notes from Alex Esquenet - our engineer friend based in Belgium: "A fast usb host can achieve 40 MBytes/sec. The theorical 60 MB/sec cannot be achieved, because of the margin taken between the sof's (125 us), so if a packet cannot take place before the sof, the packet will be rescheduled after the next sof. On top of that, all the USB transactions are handled by software on the PC. For instance, a USB host on a PCI bus will send or receive the data via the PCI bus; the stack will prepare the next data in memory and receive interrupt from the host."

Interesting. IBM is claiming copyright over this procedure, as documented 2014-01-13 at http://www.ibm.com/developerworks/aix/library/accessing-usb-drive/index.html?ca=dat

If you search the web, this is the oldest procedure online for doing this.
At no time did I assign copyright over this documentation or procedure.

You're all free to use this information.
I don't want someone claiming restrictive copyright over procedures I created and published.

  • 1