Specific system administration is required before raw devices can be enabled and used. The available tools to configure devices depend on the distribution.
Physical disk space needs to be allocated in partitions on the disks where you want to set up raw devices. The physical I/O subsystem can be on either SCSI or EIDE devices.
Creating the partitions can be done with the Linux default fdisk(8) utility. You must have “root” privileges to use the command fdisk. Refer to the fdisk(8) man pages for a complete description of the command.
This example shows how to set up partitions as raw devices, on four SCSI disks in the system—sda, sdb, sdc, and sdd.
Start fdisk on /dev/sdd:
# fdisk /dev/sdd
The system returns:
The number of cylinders for this disk is set to 8683 .... Command (m for help):
Enter “p” to print the current partition lay-out. The output is:
Disk /dev/sdd: 64 heads, 32 sectors, 8683 cylinders
Units = cylinders of 2048 * 512 bytes
Device Boot Start End Blocks Id System /dev/sdd1 1 7499 7678960 83 Linux /dev/sdd2 7500 8012 525312 82 Linux swap /dev/sdd4 8013 8683 687104 5 Extended
This sample shows the extended partition (sdd4) has 687104 free blocks, starting from 8013 and ending at 8683. The remaining partitions can be assigned later.
The next example assigns an additional partition for raw bound disk I/O:
Use the n command to create a new partition, and enter “l” at this prompt for logical.
Command (m for help):n
Command action
l logical (5 or over)
p primary partition (1-4)
Accept the default by pressing Enter on the keyboard when you are prompted:
First cylinder (8013-8683, default 8013):
Accept the default by pressing Enter on the keyboard when you are prompted:
Last cylinder or +size or +sizeM or +sizeK (8013-8683, default 8683): 8269
Use the t command, enter “5” at this prompt:
Partition number (1-8):5
Enter “60” at this prompt:
Hex code (type L to list codes): 60
The output is:
Changed system type of partition 5 to 60 (Unknown)
Repeat the above steps to create four partitions for raw device I/O.
Verify the setup using p to print the full partition table before writing it out. Make sure that there are no overlapping partitions and the type for the unassigned partitions is Unknown type 60.
The partition table can now be written to disk and you can quit the fdisk(8) utility.
Before continuing, restart your system to verify that the kernel running is in sync with the new disk partition layout. This is reported during system start when probing for disk spindles.
# /sbin/reboot