Mounting an ISO Image in Linux

You can easily access an ISO image of a CD or DVD (e.g. RHEL DVD) from the command line in Linux.

To access an ISO disc image, you have to create a mount point (empty folder that will be used as a root filesystem) and mount an ISO file to it.

In this article, i’ll show how to Mount and Unmount an ISO file from the Linux Command Line (CentOS, RHEL, Fedora, Ubuntu, Debian, Mint etc.).

To mount an ISO image in Linux, you must be a root or use sudo.

Create a Mount Point for ISO Image

A mount point – is a directory (typically an empty folder) from which the content of an ISO disc image will be accessible.

Create a mount point:

$ sudo mkdir -p /mnt/mount_point

Mount an ISO File in Linux

Mount an ISO file /home/user/disk.iso to the mount point /mnt/mount_point:

$ sudo mount -o loop /home/user/disk.iso /mnt/mount_point

After ISO disk is mounted, you will receive the following message: ‘mount: warning: /mnt/mount_point seems to be mounted read-only‘.

You can ignore it, because according to the ISO 9660 standard, ISO images are always mounted in read-only mode.

Verify that ISO File is Mounted

List mounted devices to verify that ISO image has successfully been mounted:

$ mount

Below you should see a line like the following:

/home/user/disk.iso on /mnt/mount_point type iso9660 (ro)

Now you can access the mount point and list the files stored on the ISO disk image:

$ cd /mnt/mount_point
$ ls -l

Unmount an ISO File in Linux

Use the following command to unmount an ISO disc image:

$ sudo umount /mnt/mount_point

HowTo: Remount /etc/fstab Without Reboot in Linux

The configuration file /etc/fstab contains the necessary information to automate the process of mounting partitions.

You would normally have to reboot your Linux system, after editing this file.

There is a simple way which will remount all the partitions from your /etc/fstab file without restarting the system.

Run the following command as root:

# mount -a

This simple command causes all filesystems mentioned in /etc/fstab to be remounted, except the partitions with noauto option.

HowTo: Mount Remote Windows Partition (Share) under Linux

The article describes how to mount CIFS shares manually. The shares can be on a Windows computer or on a Linux/UNIX server running Samba.

Prerequisites

1. Install cifs-utils, if it hasn’t been installed yet.

This package contains tools for mounting shares on Linux using the SMB/CIFS protocol.

# yum install cifs-utils
# sudo apt-get install cifs-utils

2. Check that NetBIOS service is running and reachable on the remote host.

Port 139 TCP – NetBIOS (Windows File and Printer Sharing).
It allows applications on separate computers to communicate over a local area network.

You can test it with telnet or nmap.

# nmap -p T:139 172.16.10.1
Nmap scan report for 172.16.10.1
Host is up (0.0011s latency).
PORT    STATE SERVICE
139/tcp open  netbios-ssn
MAC Address: 00:00:00:00:00:00 (Unknown)

# telnet 172.16.10.1 139
Trying 172.16.10.1...
Connected to 172.16.10.1.
Escape character is '^]'.

Mounting Remote Windows Share

Run all commands as root (use sudo).

Create mount point

# mkdir -p /mnt/win

Mount password protected network folder

# mount -t cifs //IP/SHARE /mnt/win/ -o dom=DOMAIN,user=USER,pass=PASS
e.g.
# mount -t cifs //172.16.10.1/private /mnt/win/ -o user=admin,pass=secret

You can use Computer/Server Name instead of IP Address.

  • ‘mount -t cifs’ – mount using the Common Internet File System (CIFS);
  • ‘-o’ – options passed to mount command;
  • ‘user=’ – username;
  • ‘pass=’ – password;
  • ‘dom=’ – domain e.g WORKGROUP (if server in domain).

Mount unprotected (guest) network folder

# mount -t cifs //IP/SAHRE /mnt/win/ -o guest
e.g.
# mount -t cifs //172.16.10.1/public /mnt/win/ -o guest
  • ‘guest’ – don’t prompt for a password.

Mount entire drive

# mount -t cifs //IP/DRIVE$ /mnt/win/ -o dom=DOMAIN,user=USER,pass=PASS
e.g.
# mount -t cifs //172.16.10.1/c$ /mnt/win/ -o user=admin,pass=secret

Unmount share

# umount /mnt/win/