Thursday, November 22, 2012

Mount cdrom/iso image on Redhat

If cdrom is not mounted by default, you can use the following...

[root@sama mnt]# cd /media/
[root@sama media]# ls
[root@sama media]#

[root@sama /]# mount -t iso9660 /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
 
[root@sama ~]#  dmesg | tail
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
SELinux: initialized (dev rpc_pipefs, type rpc_pipefs), uses genfs_contexts
eth0: no IPv6 routers present
SELinux: initialized (dev autofs, type autofs), uses genfs_contexts
SELinux: initialized (dev autofs, type autofs), uses genfs_contexts
SELinux: initialized (dev autofs, type autofs), uses genfs_contexts
ISO 9660 Extensions: Microsoft Joliet Level 3
ISO 9660 Extensions: RRIP_1991A
SELinux: initialized (dev sr0, type iso9660), uses genfs_contexts
[root@sama ~]#

[root@sama ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_sama-lv_root
                       41G  5.6G   33G  15% /
tmpfs                1011M   88K 1011M   1% /dev/shm
/dev/sda2             485M   30M  430M   7% /boot
/dev/sr0              2.9G  2.9G     0 100% /mnt

[root@sama /]# cd /mnt
[root@sama mnt]# ls
 
# eject -v /dev/cdrom-device && mount -v /dev/cdrom-device && echo $? 
 
Mounting an ISO Image 
# mount -o ro,loop My_ISO_Image.iso /media/cdrom 

Creating a Shared Mount Pointby default removable media is mounted at /media and /mnt for temporary mount point. Using the shared mount, you can share the same content on both shared.

Now, make /media directory as a shared one,
# mount --bind /media /media
# mount --make-shared /media

now, create duplicate in /mnt 
# mount --bind /media /mnt

Verify the info.

# mount /dev/cdrom /media/cdrom
# ls /media/cdrom
# ls /mnt/cdrom

You can also verify info with USB dirve as well.

# mount /dev/dsc1 /mnt/flashdisk
# ls /media/flashdisk
# ls /mnt/flashdisk

 
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/sect-Using_the_mount_Command-Mounting-Bind.html 

No comments:

Post a Comment