Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Tuesday, 10 December 2013

How to mount ISO image file on AIX


Create a new logical volume. Make sure the size of the logical volume is big enough to cover the image. In my case the size of the image is 3.59 GB. I created this image file from dvd in windows and then FTP to my lpar2.



lpar2(/)#oslevel -s
5300-12-05-1140
root@lpar2(/)#

lpar2(/backup2)#ls -la
total 16915720
drwxr-xr-x    5 root     system          256 Feb  9 12:09 .
drwxr-xr-x   20 root     system         4096 Feb  9 12:43 ..
-rw-r-----    1 root     system   3857645568 Feb  9 12:21 aix61image.iso
lpar2(/backup2)#


lpar2(/backup2)#du -gs aix61image.iso
3.59    aix61image.iso
lpar2(/backup2)#

Create a new logical volume (cdlv)

lpar2(/)#mklv -y cdlv –s n –L /dev/cdlv rootvg 1G hdisk0
OR
lpar2(/)#mklv -y cdlv rootvg 4G hdisk0
cdlv
lpar2(/)#

lpar2(/)#lsvg -l rootvg |grep cdlv
cdlv                jfs        64      64      1    closed/syncd  N/A
root@lpar2(/)#

This creates a logical volume "cdlv" with at least 670 MB. The actual physical partitions used is determined by the AIX OS.

2. Copy the ISO image to the device that contains the logical volume using command "dd".

lpar2(/)#dd if=/backup2/aix61image.iso of=/dev/cdlv bs=2048

Note that the "dd" copying is a slow process. It may take about 40 minutes or even more to copy a full CD/DVD some LPAR machine depending on the size of the image.

3. Mount the logical volume as a CD-ROM file system to read the content.

# mount -v cdrfs -o ro /dev/cdlv /mnt
# cd /mnt
# ls


           ===============================================
Mount CD/DVD in AIX

To mount a CD or DVD from the command prompt, use the following command

Create mount point:                                                                                                                      

# mkdir  /cdrom              or            # mkdir -p /cdrom

Create cdrom filesystem using:                                                                                                                

# smitty fs

 -->   Add / change / show /delete Filesystems
 -->    Add CDROM file system
                                                                                                                               
                Device Name:         [cd0]    F4                                                                                                       
                Mount Point:           [ /cdrom]                                                                                                      
                Mount Automatically   [yes]                                                                                                       

Mount the filesystem                                                                                                                   

# mount -V cdrfs -o ro /dev/cd0 /cdrom

# df -g /cdrom
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/cd0           3.64      0.00  100%  1905950   100% /cdrom

Additional Commands
# lssrc -s cdromd                          List cdrom daemon is started or not. if not then start it using following                  
# startsrc -s cdromd                   Start cdrom daemon                                                     
# lssrc -s cdromd                          check the cdrom daemon is running                                                       
# cdumount cd0                                                                                  
# cdmount cd0                                                                                     
# cdeject cd0                                                                                     
cdcheck -a cd0                                Shows cdrom is managed by cdrom daemons                                                    
# cdcheck -e cd0                             If you want to check CD is in the cdrom or not.  Does'nt matter CD is mounted or                                   not. It will shows cd is inside the CD-ROM or not.                                                             
Note:  if you want to mount CD-ROM permanently, Add start -s cdromd in the  /etc/init file.                                                                                                      
                               

           ===============================================                                                                   
Mounting an ISO image using loopmount

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 loopmount command allows you to mount mount iso images directly into filesystems on an LPAR. IF you have a iso image. With loopmount you can mount that image on a filesystem.


nimserver(/backupnim)#ls -ltr
total 8165568
drwxr-xr-x    2 root     system          256 Jan 20 10:38 lost+found
drwxr-x---    2 root     system         4096 Jan 20 10:41 ssh_aix53
-rw-r-----    1 root     system   4180508672 Feb 09 12:13 aix53image.iso
nimserver(/backupnim)#

nimserver(/backupnim)#du -gs aix53image.iso
3.89    aix53image.iso
nimserver(/backupnim)#

nimserver(/backupnim)# mkdir -p /cdmount

The loopback device will created automatically by the command. Remember unlike crfs the mount point directory must already exist.

nimserver(/)#loopmount -i /backupnim/aix53image.iso -l loop0 -o "-V cdrfs -o ro" -m /cdmount

OR

nimserver(/)#loopmount -i /backupnim/aix53image.iso -o "-V cdrfs -o ro" -m /cdmount

nimserver(/)#df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           0.25      0.14   43%     5420    13% /
/dev/hd2           2.00      0.12   94%    42801    48% /usr
/dev/hd9var        0.12      0.05   60%     2998    19% /var
/dev/hd3           0.12      0.12    4%       76     1% /tmp
/dev/hd1           0.12      0.12    1%        5     1% /home
/proc                 -         -    -         -     -  /proc
/dev/hd10opt       0.12      0.04   71%     1101    11% /opt
/dev/fslv00        1.12      0.45   61%    20631    17% /export/spot
/dev/fslv01        4.12      2.02   52%     1231     1% /export/lpp_source
/dev/fslv02        4.12      2.15   48%        5     1% /export/mksysb
/dev/fslv03       11.00      2.67   76%     1445     1% /backupnim
/dev/loop0         3.89      0.00  100%  2040988   100% /cdmount
nimserver(/)#

Now because you cannot see which image is mounted, look into the ODM :

nimserver(/)#odmget CuAt |grep -p loop0
CuAt:
        name = "loop0"
        attribute = "temporary"
        value = "yes"
        type = "R"
        generic = "DU"
        rep = "sl"
        nls_index = 3

CuAt:
        name = "loop0"
        attribute = "filename"
        value = "/backupnim/aix53image.iso"
        type = "R"
        generic = "DU"
        rep = "s"
        nls_index = 2

nimserver(/)#


Troubleshooting:

If the device (loop0) 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.

No comments:

Post a Comment