Informing the IBM Community

USB Flash Drives and IBM i

5
(2)

Optical USB 320

USB Flash Drives, thumb drives, memory sticks, call them what you may, are pretty much everywhere these days and it is a little known fact that you can use them with your IBM i server at no cost. Support was added for these devices for POWER 7 / 8 servers from IBM i v7.1 TR6 onwards.

You may not have noticed but typically there are one or two USB sockets on the front of your server and two or four more round the back (depending on your model). If your server meets the above minimums then you can literally just plug one and start using it.

How do you access them?
Once a USB Flash Drive is inserted into your system, it will show as an optical volume (like a DVD-RAM) and data on the stick will be visible with WRKOPTVOL and via the IFS in /QOPT. The system will configure a device called optical RMSnn, typically starting with RMS01.

You should see these messages being logged on the QSYSOPR message queue:

CPC2630 – Automatic configuration created device description RMSxx.
CPC2605 – Vary on completed for device RMSxx.
OPT1410 – Volume xxxxxxx added to optical device

Pro Tip: The first time you plug a flash drive into a USB port on your system it creates your RMSnn device description. To keep your device naming easy, pick the port(s) you want to use and label them. That way you’ll always know which port is RMS01, RMS02, RMS03, etc.

A simple example
You can use these devices for common commands like SAVLIB, SAVOBJ, SAVDLO & SAV just as you would a tape drive but there is a different initialise command you will need to use before you start. More on that later.

So, if for example, you wanted to save a library to a Flash Drive then you could use a command like:
SAVLIB LIB(TESTSAVE) DEV(RMS01) DTACPR(*HIGH)

savlib

Pro Tip: Notice I used the “Data Compression” parameter, RMS devices do not support hardware data compaction like most modern tape drives. So instead we can use software based Data Compression, this uses the main processor to compress the file so does have a processor overhead but on modern servers this is seldom an issue and often speeds up the save as it reduces the amount of data to be written out.

A note of caution
The write speed of these devices is not particularly fast and these drives should not be considered as reliable as tape drives. But if you need a quick, simple, inexpensive and highly portable backup medium, for ad-hoc small backups then these are ideal.

Also, when IBM launched support, they stated that there was a 32GB limit on supported devices, personally I’ve never found this limitation to be enforced and the samples used in this article where carried out using a 128GB drive.

Getting started with INZOPT
IBM i support for flash drives is based on the UDF standard, as such most drives will need to be initialised (formatted) on an IBM i system before they can be used with IBM i save / restore commands but the good news is that once formatted you can still use them with your PC, Mac or Linux device of choice just as you did before.

To initialise (format) your flash drive for use with your system you can use a command like:

INZOPT NEWVOL(‘MemStick01’) DEV(RMS01) CHECK(*NO) MEDFMT(*UDF)

inzopt
Pro Tip: If you think that you might want to use a particular flash drive with your IBM i, then pop it in your server and run the INZOPT on it before you start using it with your other devices. That way you won’t find yourself in the annoying position of copying gigabytes of data to your drive via your PC (PTFs for example) only to find your IBM i cannot read the drive as it’s still formatted with a PC file system like FAT32 or NTFS.

How to see what you’ve got
Starting with the POWER 7 you had three USB ports, (six on a POWER 8) each could have a flash drive attached, so it can be a little easy to get confused about which drive is in which port. So, you can always use the following command to list what volumes are currently mounted via which RMS device on your system:
WRKOPTVOL

wrkoptvol

Alternate IPL device
As well as being supported on the majority of IBM i’s Save and Restore commands you can also use one of these drives as an alternate IPL device (D mode IPL i.e. boot from the Flash Drive) this is particularly handy if you want to create a standard install image for a system with a custom combination of Operating System, PTFs, Device Configuration, Users, Security and even application programs and data upon it.

In this case you simply use set up your system the way you want it, pop a suitable sized Flash Drive in the USB and create your clone image with the GO SAVE menu Option 21 (Entire System Save) specifying a device name such as RMS01, once complete attach this flash drive to your target system and perform a D mode IPL from the controller attached to this drive and install as you would from any optical device.

Pro Tip:This is very handy on a HMC managed system where you want to build multiple LPARs based on a single image. e.g. creating a standard test environment. In this scenario you can simply move the Flash drive contents the between LPARs by moving the USB controller and perform a D Mode IPL. The screen shots below show a couple of typical images when carrying out such a move between LPARs on the same system.

HMC Selection
DLPAR USB
You are not just limited to IBM i Save and Restore commands
You are not just limited to IBM i based Save and Restore commands, as I mentioned at the outset, these drives are supported in their native ASCII file format via /QOPT so if you want to move some simple files like PDFs, CSVs or XML you can do just that.

Pro Tip: The Syntax of the IFS commands like CPY, REN, etc are horrid, so if you want an easy life use one of the graphical interfaces like IBM i Navigator or iNav.

USB drives are so cheap, compact and light they are an ideal way of getting image catalogues on to a server, especially when that server is remote and you want to save money on shipping. One flash drive could easily contain the contents of 25 DVDs and yet weigh less that 1 of them. What is more, when it gets to the other end you don’t have to worry about getting someone to change the DVD for you over and over again, simply tell them to insert the flash drive in the system and you are good to go.

In the following scenario imagine I want to send a set of tested PTF install images to a client site so that I can remotely install them out of hours, all my client need do is place the USB flash drive in the server and I can remotely install them whenever required.

Some of you maybe thinking I would just FTP them, well this is great if you are on a LAN or GBit WAN but most of us are still using WAN connections measured in Mbits not Gbits and as these images are often 20GB – 60GB FTP may not be feasible, or could impact bandwidth.

Put another way, you can easily get a super small form factor 32GB Flash drive for £10 on Amazon, these can cost the price of a single stamp to post, be there in under 24hours and there is zero risk of me being complained to by my client that their “business critical Internet connections” are not usable. By the way, this is often code for the boss not being able to stream the highlights of last night’s game to his iPad whilst enjoying his morning coffee.

Using a flash drive to copy image catalogues to your system from a PC
Step 1 – Place the flash drive that you formatted (with INZOPT on IBM i as shown earlier) into your PC / Mac / Masochistic Linux Distro of your choice and copy over your image catalogue files using file manager as you would for any other file. I’ve used Windows 7 and Explorer in the example below as I’m neither wealthy or socially challenged 😉

Step 1 Copy files to flash drive on PC
Step 2 – Send Flash drive to the remote site and have it inserted into the POWER server that is to be updated.
Use the WRKOPTVOL to check you can see the flash drive.
Pro Tip: Use option 11 to drill down into the contents of the drive to make sure it’s the correct flash drive.

Step 2 WRKOPTVOL to find RMS name
Step 3 – Make a note of the directory and file names using WRKLNK or EDTF

Step 3 note the directory path and file names
Pro Tip: Using edft ‘/qopt’ as shown above, allows you to drill down to the directory you want with a series of option 5’s but unlike WRKLNK you get a handy display with file sizes and dates as well.

Step 4 – Copy the files from USB Flash Drive to local IFS folder
Use CRTDIR ‘/v7R2ptfs’ to create an empty folder to receive the files
Use CPY OBJ(‘/qopt/PTFS/IBM i v7.2Ptfs/*’) TODIR(‘/v7r2ptfs’) to copy the files from Flash Drive to local directory

Step 4 Copy files from Flash to local directory
Step 5 – Create an image catalogue using the automatic add volume option
CRTIMGCLG IMGCLG(V7R2PTF) DIR(‘/qopt/PTFS/IBM i v7.2Ptfs’) CRTDIR(*NO) ADDVRTVOL(*DIR)
This saves you having to issue an ADDIMGCLGE for each of the DVD images you wish to include in the image catalogue. This function was introduced in IBM i v7.2, if you want to know more check out the article I wrote called 7.2 things iLove about v7.2.

Step 5 Create image catalogue
Step 6 – Check your image catalogue
User WRKIMGCLG Option 12 to check that you have all the file names you were expecting from step 3

Step 6 Check your image catalogue
From this point onwards it’s just like any other Image catalogue PTF install, you can mount and verify and install PTFs as you normally would.

In Conclusion
These devices aren’t likely to replace your tape drive totally any time soon but in the right circumstance they can save you time, money and hassle. So why not give them a try.

Nice to see you
Our next meeting will take place back at the ancestral home of the i-UG, Norton Grange, in Rochdale, on Thursday 8th February 2016. We will then repeat the event with the same agenda in Central London at ArrowECS’s offices in the Royal Exchange on Thursday 3rd March.
We’ve already confirmed a number of excellent guest speakers. Hope to see you there, more details and registration available at www.i-ug.co.uk

 

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.