07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Configuration of the bootloader must identify the different hard drives and their partitions.<br />

Linux uses a special filesystem (in “block” mode) stored in the /dev/ directory, for this purpose.<br />

Historically, /dev/hda was the master disk on the first IDE controller, and /dev/hdb its first<br />

slave, /dev/hdc and /dev/hdd being, respectively, the master and slave disks on the second IDE<br />

controller, and so on down for any others. /dev/sda corresponded to the first SCSI drive, /dev/<br />

sdb being the second, etc. This naming scheme has been unified with the Linux kernel present<br />

in Squeeze, and all hard drives (IDE/PATA, SATA, SCSI, USB, IEEE 1394) are now represented by<br />

/dev/sd*.<br />

Each partition is represented by its number on the disk on which it resides: for instance, /dev/<br />

sda1 is the first partition on the first disk, and /dev/sdb3 is the third partition on the second<br />

disk.<br />

The PC architecture (or “i386”) is limited to four “primary” partitions per disk. To go beyond<br />

this limitation, one of them must be created as an “extended” partition, and it can then contain<br />

additional “secondary” partitions. These secondary partitions must be numbered from 5. Thus<br />

the first secondary partition could be /dev/sda5, followed by /dev/sda6, etc.<br />

It is not always easy to remember what disk is connected to which SATA controller, or in third<br />

position in the SCSI chain, especially since the naming of hotplugged hard drives (which includes<br />

among others most SATA disks and external disks) can change from one boot to another.<br />

Fortunately, udev creates, in addition to /dev/sd*, symbolic links with a fixed name, which you<br />

could then use if you wished to identify a hard drive in a non-ambiguous manner. These symbolic<br />

links are stored in /dev/disk/by-id. On a machine with two physical disks, for example,<br />

one could find the following:<br />

mirexpress:/dev/disk/by-id# ls -l<br />

total 0<br />

lrwxrwxrwx 1 root root 9 23 jul. 08:58 ata-STM3500418AS_9VM3L3KP -> ../../<br />

➥ sda<br />

lrwxrwxrwx 1 root root 10 23 jul. 08:58 ata-STM3500418AS_9VM3L3KP-part1 -><br />

➥ ../../sda1<br />

lrwxrwxrwx 1 root root 10 23 jul. 08:58 ata-STM3500418AS_9VM3L3KP-part2 -><br />

➥ ../../sda2<br />

[...]<br />

lrwxrwxrwx 1 root root 9 23 jul. 08:58 ata-WDC_WD5001AALS-00L3B2_WD-<br />

➥ WCAT00241697 -> ../../sdb<br />

lrwxrwxrwx 1 root root 10 23 jul. 08:58 ata-WDC_WD5001AALS-00L3B2_WD-<br />

➥ WCAT00241697-part1 -> ../../sdb1<br />

lrwxrwxrwx 1 root root 10 23 jul. 08:58 ata-WDC_WD5001AALS-00L3B2_WD-<br />

➥ WCAT00241697-part2 -> ../../sdb2<br />

[...]<br />

lrwxrwxrwx 1 root root 9 23 jul. 08:58 scsi-SATA_STM3500418AS_9VM3L3KP -><br />

➥ ../../sda<br />

lrwxrwxrwx 1 root root 10 23 jul. 08:58 scsi-SATA_STM3500418AS_9VM3L3KP-part1<br />

➥ -> ../../sda1<br />

162 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!