Wednesday, December 31, 2008

Adding a SCSI Disk in Fedora Core 9 Linux

This is a short guide that provides procedures on how to be able to use a new SCSI disk in Linux. This is based on my own notes. Your comments and suggestions are welcome J

After physically attaching the disk, as root, use fdisk –l to check if the physical disk can now be seen by Linux. 

The first disk that I had originally is also a SCSI disk (thus the device name is /dev/sda and the second disk is sdb). We can see that Linux now sees the second SCSI disk, at the device, /dev/sdb. Linux’s naming convention for SCSI devices are usually /dev/sd[a-p]. 

Now, after confirming the device name of the new disk, (e.g /dev/sdb) you may now use fdisk to create a new partition or initialize the whole disk

  1. As root, type fdisk /dev/sdb
  2. On the command prompt, enter ‘n’ without the quotes to add a new partition.
  3. Choose ‘p’ to create a primary partition
  4. Choose ‘1’ for the partition number
  5. Press enter twice to use the defaults for the cylinder sizes
  6. Type ‘w’ to write the changes to disk and exit

Now, after creating the partitions, you’d need to specify the file system that the disk will be formatted with. In this case, I’ll be using EXT3. 

  1. Type mkfs.ext3 /dev/sdb to start formatting the disk as EXT3
  2. When prompted that if you’d want to format the whole disk, choose ‘y’
  3. When prompted for the total blocks of the journal, press enter to accept the defaults

After formatting the device, you would need to create a mount point for the device. Mount points are normal directories that users use to access the device. In this case, we will be creating a directory named disk2 under /opt/disks/ 

  1. Type mkdir –p /opt/disks/disk2

Now we need to add the mount point and information regarding the new disk into Linux’s fstab. fstab is a file that Linux uses to get information about the various filesystems.

  1. Add the line above at the end of the fstab file, /etc/fstab
  2. Reboot or mount /dev/sdb to be able to access the device
  3. Create directories on the mount point (/opt/disks/disk2/), accessible to non-root users, using the chown command to give them the ownership to the directories.
  4. You may want to create links users to access these directories

After these steps, the second SCSI disk should now be accessible and users will be able to create/access files from the disk. For further details on fstab and other useful information, please visit fstab’s manpage. 

No comments: