Friday, 25 July 2014

custom script to speed up mount iso - EXPLAINED

I read once that good system admin will write a script for something that he has to do more than few times. Especially if you have to write down long command lines for something that is not very important but it is still time consuming.

Very often I have to mount iso files on file system. Command line for this is

server#mount -t iso9660 /location_of_iso /mount_point -o loop

This is not very long but after some time even this can be very annoying.
So I decided to speed things up.

I wrote simple script called mount_iso. I look like this

server# cat mount_iso
echo $ISO
mount -t iso9660 $ISO /mnt/ -o loop

Make it executable.
server#chmod +x mount_iso

In is good to move this script in folder from where you call other scripts and programs to run.

server# env |grep PATH

I moved my to /bin.

How it works?

server# mount_iso rhel-server-6.3-i386-dvd.iso
server# mount |grep mnt
/opt/iso/rhel-server-6.3-i386-dvd.iso on /mnt type iso9660 (rw,loop=/dev/loop0)

I predefined mount point to be /mnt just because this is convenient for me.

This only saves few seconds of my time but it I find it very useful.

No comments: