IBM Support

Loopback Device Support in AIX

Question & Answer


Question

This technote discusses the use of the loopback device to mount file or disk images in AIX

Answer

Introduction
In AIX 6100-04-00-0943 (6.1 TL4) support for a loopback device was added to AIX and VIOS (PowerVM). This device can be used as a block device to provide access to file images.

The file to be mounted can be an ISO image, a disk image, a filesystem image or a logical volume image. These images can be mounted into the filesystem tree via the /usr/sbin/loopmount command.

A loopback device can be created before mounting a file image using /usr/sbin/mkdev or the loopmount command can automatically create it.

According to the AIX 6.1 manuals on Infocenter, there are some restrictions to the loopback device:

  • The varyonvg command on a disk image is not supported.
  • A CD ISO and other CD images are only supported in read-only format.
  • An image file can be associated with only one loopback device.
  • Loopback devices are not supported in workload partitions.
  • DVD images and UDFS filesystems are supported in recent versions of AIX.

Mounting a CD Image File
To mount a file on the loopback device, the loopmount command is used. In the example below the loopback device is created automatically by the command.

Remember unlike crfs the mount point directory must already exist.

# mkdir /image
# loopmount -i /backup/cd_image_327874 -l loop0 -o "-V cdrfs -o ro" -m /image
 
# df
/dev/loop0       1678304         0  100%   419576   100% /image
 
# lsdev -C | grep loop
loop0      Available       Loopback Device

# cd /dev
# ls -l loop*
brw-rw----    1 root     system       34,  0 Nov 27 06:43 loop0

During its existence the loopback device is listed in the CuAt, CuDv and CuDvDr ODM object classes.


Mounting a UDF Image File
UDF filesystems (common on DVD or DVD-ROM media) are supported on recent versions of AIX:
    • 7200-01-00 containing APAR IV84495
    • 7100-04-03 containing APAR IV84413

Using the above example the command to mount the file as a UDF image would be:

# loopmount -i UDF_FILE.iso -l loop0 -o "-V udfs -o ro" -m /image


Unmounting a File
To unmount a file mounted on the loopback device, use /usr/sbin/loopumount. If the regular /usr/sbin/umount command is used the dynamically created loopback device will not be unconfigured.

# loopumount -l loop0 -m /image

Notice that since the loop0 device was created dynamically in the previous mount it will be deleted when not needed any more.

# df | grep loop
<nothing returned>

# lsdev -C | grep loop
<nothing returned>


Possible Problems and Solutions

Loopback device not found in ODM
# loopmount -i /images/IBM.iso -l loop0 -o "-V cdrfs -o ro" -m /image
1320-003 loopmount: Specified loopback device is not found in ODM Customized Database

Using the -l option assumes the loopback device already exists in /dev and the ODM classes.

If the device doesn't exist you can create it with mkdev:

# mkdev -c loopback -s node -t loopback
loop0 Available

Then use loopmount with -i and -l options to mount into the filesystem tree.

Image fails to mount:
# loopmount -i /images/IBM.iso -o "-V cdrfs -o ro" -m /image
1320-007 loopmount: Failed to mount the imagefile

Make sure the mount point directory exists
Check the mount options. Readonly must be supplied.


Applicable APARs
This is a list of loopback related APARs and versions of AIX they are fixed in.

IV34996 LOOPMOUNT HANGS IN CFGLOOP APPLIES TO AIX 6100-06-11
IV34649 LOOPMOUNT HANGS IN CFGLOOP APPLIES TO AIX 6100-07-07
IV34268 LOOPMOUNT HANGS IN CFGLOOP APPLIES TO AIX 6100-08-02
IV34396 LOOPMOUNT HANGS IN CFGLOOP APPLIES TO AIX 6100-09-00
IV35222 LOOPMOUNT HANGS IN CFGLOOP APPLIES TO AIX 7100-00-09
IV31570 LOOPMOUNT HANGS IN CFGLOOP APPLIES TO AIX 7100-01-07
IV34375 LOOPMOUNT HANGS IN CFGLOOP APPLIES TO AIX 7100-02-02

IV58244 LOOPMOUNT CAN CRASH THE SYSTEM APPLIES TO AIX 6100-07-10
IV57935 LOOPMOUNT CAN CRASH THE SYSTEM APPLIES TO AIX 6100-08-05
IV51885 LOOPMOUNT CAN CRASH THE SYSTEM APPLIES TO AIX 6100-09-03
IV47155 LOOPMOUNT CAN CRASH THE SYSTEM APPLIES TO AIX 7100-02-05
IV51480 LOOPMOUNT CAN CRASH THE SYSTEM APPLIES TO AIX 7100-03-03

IV81252 LOOPMOUNT A JFS2 IMAGE CRASHES THE SYSTEM APPLIES TO AIX 6100-09-07
IV80026 LOOPMOUNT A JFS2 IMAGE CRASHES THE SYSTEM APPLIES TO AIX 7100-03-07
IV81267 LOOPMOUNT A JFS2 IMAGE CRASHES THE SYSTEM APPLIES TO AIX 7100-04-02
IV81267 LOOPMOUNT A JFS2 IMAGE CRASHES THE SYSTEM APPLIES TO AIX 7100-04-03

IV07144 STORAGE KEY EXCEPTION IN KWAKEUP DURING LOOPMOUNT APPLIES TO AIX 6100-05-08
IV10588 STORAGE KEY EXCEPTION IN KWAKEUP DURING LOOPMOUNT APPLIES TO AIX 6100-06-07
IV14776 STORAGE KEY EXCEPTION IN KWAKEUP DURING LOOPMOUNT APPLIES TO AIX 7100-00-05

IV64843 SYSTEM CRASH IN FP_FSTAT DOING IOCTL TO LOOPMOUNT DEVICE APPLIES TO AIX 6100-09-06
IV67372 SYSTEM CRASH IN FP_FSTAT DOING IOCTL TO LOOPMOUNT DEVICE APPLIES TO AIX 7100-03-05

IV78444 LOOPMOUNT COMMAND MAY FAIL FOR READ-ONLY NFS MOUNT APPLIES TO AIX 6100-09-08
IV79296 LOOPMOUNT COMMAND MAY FAIL FOR READ-ONLY NFS MOUNT APPLIES TO AIX 7100-04-03

[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"File management","Platform":[{"code":"PF002","label":"AIX"}],"Version":"6.1;7.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
17 June 2018

UID

isg3T1012661