Page 155 - DCAP106_OPERATING_SYSTEM_TOOLS
P. 155
Operating System Tools
Notes ~$ ls -l /dev/sda1
brw-rw---- 1 root disk 8, 1 Nov 12 10:10 /dev/sda1
A regular ATA disk (or DVD-ROM) would be represented by /dev/hda (hd stood for hard disk
but is now seen as the identification of an ATA device).
$ ls -l /dev/hda
brw-rw---- 1 root cdrom 3, 0 Apr 23 21:00 /dev/hda
On a default installation, the device manager (which is called udev) creates the device files as it
encounters the hardware. For instance, on my system, the partitions for my first SATA device
can be listed as follows:
$ ls -l /dev/sda*
brw-r----- 1 root disk 8, 0 Sep 30 18:11 /dev/sda
brw-r----- 1 root disk 8, 1 Sep 30 18:11 /dev/sda1
brw-r----- 1 root disk 8, 2 Sep 30 18:11 /dev/sda2
brw-r----- 1 root disk 8, 5 Sep 30 18:11 /dev/sda5
brw-r----- 1 root disk 8, 6 Sep 30 18:11 /dev/sda6
brw-r----- 1 root disk 8, 7 Sep 30 18:11 /dev/sda7
brw-r----- 1 root disk 8, 8 Sep 30 18:11 /dev/sda8
The ‘mount’ Command and the fstab file
The mount command performs the act of mounting a medium to the file system. To perform
well, it needs some information, such as the mount point, the file system type, the device and
optionally some mounting options.
Example: The mount command to mount /dev/sda7, housing an ext3 file system, to
/home, would be:
# mount -t ext3 /dev/sda7 /home
It can be seen that the act of mounting a file system is like “attaching” a certain storage
somewhere on the file system, effectively expanding the file system with more files, directories
and information.
Nevertheless, if there are various different partitions in your system, it would be a joke to have
to enter the commands every time over and over again. This is one of the reasons why Linux has
a file system definition file called /etc/fstab.
!
Caution The fstab file includes all the information mount could need in order to successfully
mount a device.
An example fstab is shown below:
/dev/sda8 / ext3 defaults,noatime 0 0
/dev/sda5 none swap sw 0 0
/dev/sda6 /boot ext2 noauto,noatime 0 0
/dev/sda7 /home ext3 defaults,noatime 0 0
/dev/sdb1 /media/usb auto user,noauto,gid=users 0 0
148 LOVELY PROFESSIONAL UNIVERSITY