Add SCSI Drives to Linux

First we should have an overview of the hardware on this server. There are two Perc controllers, a Perc5i and a Perc6i. The Perc5 has an MD1000 drive enclosure attached and the Perc6 has the internal drives attached.

Perc6/i:
OS Disk RAID 1 278GB
Internal Storage 836GB

Perc5/i:
MD1000 RAID 10 External Storage 4.88TB

Over the next few posts I will set the storage up as follows:
/dev/sdb will be set up as an NFS export for VMware.
/dev/sdc will be set up as an iSCSI mount for VMware.

From dmesg:

 sda:
 sdb:
 sdc: sda1 sda2
sd 0:2:0:0: [sda] Attached SCSI disk

sd 0:2:1:0: [sdb] Attached SCSI disk

sd 1:2:0:0: [sdc] Attached SCSI disk
sr0: scsi3-mmc drive: 24x/24x writer cd/rw xa/form2 cdda tray
Uniform CD-ROM driver Revision: 3.20
sr 2:0:0:0: Attached scsi CD-ROM sr0
dracut: Scanning devices sda2  for LVM logical volumes vg_testlabstorage5/lv_root vg_testlabstorage5/lv_swap
dracut: inactive '/dev/vg_testlabstorage5/lv_root' [50.00 GiB] inherit
dracut: inactive '/dev/vg_testlabstorage5/lv_home' [222.54 GiB] inherit
dracut: inactive '/dev/vg_testlabstorage5/lv_swap' [5.84 GiB] inherit

Create Partition
Setting our partition table wit parted because they are larger than 2TB. This snippet shows what happens when you don’t have a partition table.

(parted) select /dev/sdd
Using /dev/sdd
(parted) print
Error: /dev/sdd: unrecognised disk label

(parted) mklabel
New disk label type? gpt

(parted) print
Model: DELL PERC 5/E Adapter (scsi)
Disk /dev/sdd: 2249GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

I want to create a partition table on /dev/sdb.

parted /dev/sdb

(parted) print
Model: DELL PERC 6/i (scsi)
Disk /dev/sdb: 898GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) unit GB

(parted) print
Model: DELL PERC 6/i (scsi)
Disk /dev/sdb: 898GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart primary 0.00GB 898GB
(parted) print
Model: DELL PERC 6/i (scsi)
Disk /dev/sdb: 898GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size   File system  Name     Flags
 1      0.00GB  898GB  898GB               primary

Create file system
The partition /dev/sdb1 has been created but does not have a file system laid down. If you want to put a simple file system on it and mount it follow the steps below. If you want to use LVM skip below.

Now we want to put an ext4 file system.

mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
54829056 inodes, 219315712 blocks
10965785 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
6693 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
	102400000, 214990848

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mount File System
Finally a simple mount of the file system.

mkdir /internal_storage
mount -t ext4 /dev/sdb1 /internal_storage

LVM
I want to work with the logical volume manager (LVM).

pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created

vgcreate vg_internal_storage -l 0 -p 0 -s 32m /dev/sdb1
  Volume group "vg_internal_storage" successfully created

vgchange -ay vg_internal_storage
  0 logical volume(s) in volume group "vg_internal_storage" now active

lvcreate -L 836g -r auto -n lv_internal_storage vg_internal_storage
  Logical volume "lv_internal_storage" created

vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg_internal_storage" using metadata type lvm2
  Found volume group "vg_testlabstorage5" using metadata type lvm2

mkfs.ext4 /dev/vg_internal_storage/lv_internal_storage

mount /dev/vg_internal_storage/lv_internal_storage /internal_storage/

Add the file system and mount point to /etc/fstab.

cat /etc/fstab | grep -v \#
/dev/mapper/vg_testlabstorage5-lv_root /                       ext4    defaults        1 1
UUID=9add185a-eef1-45f0-8c92-a0f6909d6e36 /boot                   ext4    defaults        1 2
/dev/mapper/vg_testlabstorage5-lv_home /home                   ext4    defaults        1 2
/dev/mapper/vg_testlabstorage5-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/mapper/vg_internal_storage-lv_internal_storage /internal_storage ext4 defaults 1 1

NFS share for VMware

cat /etc/exports
/internal_storage	172.22.104.70(rw,sync,no_root_squash,no_subtree_check)
/internal_storage      172.22.104.71(rw,sync,no_root_squash,no_subtree_check)
/internal_storage      172.22.104.72(rw,sync,no_root_squash,no_subtree_check)
/internal_storage      172.22.104.73(rw,sync,no_root_squash,no_subtree_check)

/etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Stopping RPC idmapd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]

chkconfig nfs on

rpcinfo  | grep nfs
    100003    2    tcp       0.0.0.0.8.1            nfs        superuser
    100003    3    tcp       0.0.0.0.8.1            nfs        superuser
    100003    4    tcp       0.0.0.0.8.1            nfs        superuser
    100227    2    tcp       0.0.0.0.8.1            nfs_acl    superuser
    100227    3    tcp       0.0.0.0.8.1            nfs_acl    superuser
    100003    2    udp       0.0.0.0.8.1            nfs        superuser
    100003    3    udp       0.0.0.0.8.1            nfs        superuser
    100003    4    udp       0.0.0.0.8.1            nfs        superuser
    100227    2    udp       0.0.0.0.8.1            nfs_acl    superuser
    100227    3    udp       0.0.0.0.8.1            nfs_acl    superuser
    100003    2    tcp6      ::.8.1                 nfs        superuser
    100003    3    tcp6      ::.8.1                 nfs        superuser
    100003    4    tcp6      ::.8.1                 nfs        superuser
    100227    2    tcp6      ::.8.1                 nfs_acl    superuser
    100227    3    tcp6      ::.8.1                 nfs_acl    superuser
    100003    2    udp6      ::.8.1                 nfs        superuser
    100003    3    udp6      ::.8.1                 nfs        superuser
    100003    4    udp6      ::.8.1                 nfs        superuser
    100227    2    udp6      ::.8.1                 nfs_acl    superuser
    100227    3    udp6      ::.8.1                 nfs_acl    superuser

Sources:
http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html
http://www.thegeekstuff.com/2011/09/parted-command-examples/
http://sakafi.wordpress.com/2008/08/23/how-to-use-parted-for-creating-patition-larger-that-2-tb/

This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s