Knowledge Base Glossary       Exit
(how to) Search  

Browse by Category
Knowledge Base > Products > Image for Linux > FAQ > Mounting Drives and Partitions on the IFL Boot Disk

Mounting Drives and Partitions on the IFL Boot Disk

This article is to provide information relevant to mounting drives and partitions on the IFL Boot Disk. Mounting makes the contents of a drive or partition available in a specified directory in the local file system. Once mounted, files on the drive or partition can be copied to/from the IFL Boot Disk, and can also be edited, deleted, etc. Most of the information here will also apply to Linux in general.

The article is divided into the following sections:

  1. Drive and Partition Naming in Linux (Device Naming)
  2. Matching up a Device Name with a Description of the Drive
  3. Listing Partitions on Hard Drives
  4. Mounting Hard Drive Partitions
  5. Mounting CD/DVD Drives and Floppy Drives
  6. Mounting USB Flashdrives
  7. Listing Mounted File Systems

1. Drive and Partition Naming in Linux:

All drives and partitions in Linux are assigned names that correspond to a special file (a device file) located in the /dev directory of the Linux file system. For that reason, all device names are prefaced with a /dev.  Determining the correct device name for the drive or partition that you want to mount is often the biggest roadblock to successfully mounting it. This section summarizes the device names used for the most common storage devices:

  • Hard drives: The category of hard drives includes PATA drives (connected to an IDE controller), SATA drives, SCSI drives, USB drives, and IEEE1394 (Firewire) drives.

    On the IFL Boot Disk, the majority of hard drives will will be named /dev/sdx, as in /dev/sda, /dev/sdb, and so on. The exceptions to this will be PATA drives that are connected to certain IDE controllers that still require an older driver. In those cases, the hard drives will be named /dev/hdx, as in /dev/hda, /dev/hdb, and so on. Drive designations such as /dev/sdb and /dev/hdc represent the entire hard drive.

    Partitions on hard drives are named by adding a number after the drive designation, so that the first partition on /dev/hda will be /dev/hda1, the second partition will be /dev/hda2, and so on.

  • CD/DVD Optical Drives: This category includes IDE/ATAPI drives (connected to an IDE controller), USB drives, IEEE1394 (FireWire) drives, SATA drives, and SCSI drives.

    On the IFL Boot Disk, the majority of CD/DVD optical drives will be named /dev/srx, as in /dev/sr0, /dev/sr1, and so on. Similar to the situation with hard drives, there will be some exceptions for drives that are connected to certain IDE controllers that still require an older driver. In those cases, CD/DVD drives will be named /dev/hdx, as in /dev/hda, /dev/hdb, and so on.

    Note that /dev/srx drives are also named /dev/scdx, so that /dev/sr0 is the same device as /dev/scd0 and can be accessed with either name.

  • USB Flashdrives: These are named the same way as USB hard drives and will always appear as dev/sdx devices such as /dev/sdb, /dev/sdc, and so on. Note that USB flashdrives can be either partitioned or non-partitioned. If they are partitioned, the partitions are named the same way as for hard drives.

  • Standard Floppy Drives: Floppy drives connected to a standard floppy drive controller will be named /dev/fdx, as in /dev/fd0, /dev/fd1.

  • USB Floppy Drives: These devices are named the same as USB hard drives or USB flashdrives and will always be /dev/sdx devices, such as /dev/sdc, /dev/sdd, and so on.

2. Matching up a Device Name with a Description of the Drive

Given the naming conventions described above, newcomers to Linux can experience some confusion as to which drive is which. The IFL Boot Disk contains 2 commands that should be helpful in this regard.

First, the blkid command, which is part of e2fsprogs, will list all detected file systems (one per line), and will display the device name, the label (if any), the file system type, and the file system UUID. Note that devices not containing any file system, such as an unformatted partition or UFD, will not be listed by blkid.

Second, the listhw command is a script provided by the IFL Boot Disk. This script will list all storage devices detected on the system, and match up the device name with a description of the device (size, type, manufacturer/model). To run this command, just type listhw at the Linux command prompt.

3. Listing Partitions on Hard Drives (and Partitioned USB Flashdrives)

The fdisk command will list partitions on hard drives as follows:

fdisk -l                 list all partitions on all drives
fdisk -l /dev/hdb    list all partitions on drive /dev/hdb
fdisk -l /dev/sda    list all partitions on drive /dev/sda

Note: The "-l" in the above commands is a hyphen followed by a lower-case "L".

4. Mounting Hard Drive Partitions (Linux, FAT/FAT32, NTFS):

Note: IFL versions 2.62 and later include the 'dpmount' command, which is a script that will mount and unmount drives and partitions from a menu interface. To use it, exit to the command prompt, and type 'dpmount'. The information below covers how to mount and unmount manually, if desired.

Mounting any storage device in Linux requires two pieces of information: the name of the device (partition in this case) to mount and where to mount it (the mount point). The mount point should be an empty directory, and that directory will contain the contents of the partition once it is mounted. On the IFL Boot Disk, the /mnt directory is an empty directory that can be used for this purpose.

Except for NTFS partitions, hard drive partitions can be mounted as follows:

mount /dev/sda2 /mnt

Where /dev/sda2 is the partition to mount and /mnt is the mount point.

Mounting an NTFS patition requires a different command as follows:

ntfs-3g /dev/sda2 /mnt

Once the mount command has executed without giving any error messages, this indicates that the mount was successful. The mount can be further verified by running one or more of the following commands:

df             lists mounted file systems
mount      same as above, but in a different format
ls /mnt     list files on the partition (equivalent to DOS dir command)

With a successful mount, the contents of the partition will be available in the directory used as the mount point (/mnt is the mount point in the examples above). The /mnt directory already exists on the IFL boot disk and is intended to be used as a mount point.

If you wanted to create or restore an image to/from a mounted partition with IFL, you would use the Backup To File (OS) or the Restore From File (OS) option and then navigate to the directory being used as the mount point. Note that for FAT/FAT32, NTFS, and EXT2/3 partitions, it is not necessary to manually mount a partition in order to save or restore an image to/from it. Those types of partitions can be accessed directly from within IFL.

To unmount any partition, the umount command is used:

umount /mnt

Note that there is no special requirement to specifically use the /mnt directory as the mount point for hard drive partitions. You can use any available empty directory, or can create a new one with the mkdir command (e.g. mkdir /mydirectory).

5. Mounting CD/DVD Drives and Floppy Drives:

To mount a CD or DVD disc, the /cdrom directory is provided as an already existing mount point. Again, you will need to know the name of the device to mount, such as /dev/hdc or /dev/sr0. The mount command is as follows:

mount /dev/hdc /cdrom
mount /dev/sr0 /cdrom

Where /dev/hdc or /dev/sr0 is the CD/DVD device and /cdrom is the mount point.

To unmount the drive, the following command can be used:

umount /cdrom

To mount a floppy drive, the /floppy directory is provided as an already existing mount point. The mount command would be:

mount /dev/fd0 /floppy     (for a standard non-USB floppy drive)
mount /dev/sdx /floppy    (for a USB floppy drive)

To unmount the drive:

umount /floppy

Note that there no special requirement to specifically use the /cdrom and /floppy directories as mount points for CD/DVD discs and floppy drives, respectively. You can use any available empty directory or can create a new one with the mkdir command (e.g. mkdir /mydirectory).

6. Mounting USB Flashdrives

As mentioned above, USB flashdrives can be either partitioned or non-partitioned devices. If the drive is partitioned, you would use the same procedure as for a hard drive partition covered in Section 4 above. If the drive is not partitioned, it would be mounted the same way as a USB floppy drive, as covered in Section 5 above.

Note again that USB flashdrives will always be /dev/sdx devices, regardless of whether they are partitioned or not. If partitioned, the partitions will be named the same as for a /dev/sdx hard drive (e.g. /dev/sda1, /dev/sda2, etc.).

7. Listing Mounted File Systems:

The following commands will all list mounted file systems, each in a different format. These provide a way to verify that a mount or umount command worked as expected. The listing will include mounted network shares, such as Samba or NFS shares.

df
mount
cat /proc/mounts

 


How helpful was this article to you?


powered by Lore