Understanding Linux Devices

Understanding Linux Devices
Page content

Getting Used to Linux Devices

When I first abandoned Microsoft (MS) Windows in 2003 to switch to Fedora Linux, one thing I had trouble adjusting to is not seeing C: as the designation for the local disk, A: for the floppy drive and so on. This was because I wasn’t familiar with how Linux devices are reported. These would include external and local disks, Compact Disc (CD) and Digital Versatile Disc (DVD) drives for reading and writing data, Universal Serial Bus (USB) drives and even old floppy drives. Learning how they are handled under Linux is important regardless of the distribution you choose to use. We’ll look at a couple of scenarios; one involves a single local disk with a pen (USB) drive, also known as a “jump” or “thumb” drive, attached. The other is a single SCSI drive with four partitions for a triple boot system.

Is It SCSI or IDE?

While it isn’t necessary to have full understanding of how drives work, it’s a good idea to be aware that there are what’s known as Small Computer Systems Interface (SCSI) drives and Advanced Technology Attachment (ATA) drives because they are Linux devices that are designated according to a system different from MS Windows. Often, ATA drives are loosely referred to as Integrated Drive Electronics (IDE) drives and you should know that there are also Serial Advanced Technology Attachment (SATA) drives that could be attached to your machine. If you have an IDE/ATA drive, you will see the letters “hd” preceding the drive designation. If you have a SATA or SCSI drive, you should see “sd” leading the designation. Note that under some distros, especially older ones such as Fedora (Core) 4, you might see “scd” for a SCSI device as in “scd0.” You could also see “/dev/cdrom/” instead of “hd,” “sd” or “scd.” This is almost always caused by a symlink.

How Linux Sees Drives

Let’s say you have one SCSI drive installed. You should have at least two partitions since Linux requires a swap; one for the distribution you’re running and the other for the swap. They would typically be designated “sda1” and “sda2” respectively. This is not figuring for any logical partitions, just a primary and an extended one. Logical partitions begin numbering at five, for example, “sda5” If you are a newbie to Linux and to partitioning, you probably want to avoid working with logical partitions also known as logical volumes. Let’s say that you have a SCSI drive and a pen drive mounted. Your SCSI would still be “sda1” and “sda2,” and the pen drive should show as “sdb1.” If you were to add a second pen drive, it should mount as “sdc1.” To break this system of Linux devices down we look at each section of the designation. The “sd” indicates a SCSI based drive; an “hd” would indicate an IDE/ATA drive. The “a” reveals that it is your primary master drive; in this case there’s only one, so it is primary and master. The number (1) indicates the partition number. For example, the first partition on the primary master drive is “sda1.” The second partition is “sda2,” the third is “sda3,” and the fourth is “sda4.” Linux numbers 1 - 4 for primary or extended partitions. If you need more, you could set up logical volumes.

Understanding the Linux Umount: Device Is Busy Message

Unlike the freedom you have under Windows to simply unplug a pen drive without first stopping it, although it’s safer to stop it, you should never do this under Linux. These drives should be unmounted before being removed. Most people work in a Graphical User Interface (GUI) and see an icon of the drive right on the desktop. They can simply right click on it and choose the option to unmount before removing it. The “umount” command is used to accomplish the same thing when working on a command line.

There are times when you might see the Linux umount: device is busy message which is a warning not to physically remove the drive. Unless the system has become unstable, you usually have a file on the drive still open or you are sitting in a directory on the drive. Simply closing all files stored on the drive or, if you are working on a command line, navigating out of the drive will solve the problem. In fact, these are the first steps that should be taken when you see the Linux umount: device is busy message.

Using Fdisk to Report on Linux Devices

Below is a screen shot of the Linux devices report I generated for my computer set up as a triple boot system. You can do the same for your machine by opening a terminal which might be called a console by your distro, typing “fdisk -l” and pressing enter. You might have to become root for this. You can see how I have only one local disk with four partitions: /dev/sda1 holding Windows XP, /dev/sda2 holding Puppy Linux, /dev/sda3 is a swap, and /dev/sda4 holds Fedora Linux. Puppy and Fedora share the swap partition. If you should ever want to set up a dual or triple boot system, you’ll need a basic, but solid understanding of partitions and Linux devices.