mdsh.com/wiki


RecentChanges

TextFormattingRules
AllWikiTopics
OrphanedWikiTopics
ToDoWikiTopics
WikiLockList
RSS
Export2HTML

WikiSearch

SetUsername

StartingPoints
Home
4ksector:raid1:lvm:xfs @May 8, 2011 10:57:57 AM

Notes of making two 2TB WD Cavair Green (WD20EARS) drives into a RAID 1, LVM, XFS set.


I am adding two of these drives to an existing system. In this system they are connected to their own PCI SATA card which has made the disks /dev/sda and /dev/sdb. This system boots from a completely different disk.

These disks lie. They say they have 512 byte sectors, but they are actually 4096 byte sectors. So, even though we are going to partition the disk by 512 byte sectors we have to make the partition on boundaries of 8 of those sectors.

These drives want to park their disk heads after 8 seconds on inactivity, which adds up to a lot of parking. The Internet forums suggest using hdparm to set that time to 1 hour. The best way to persist that is to put these lines into /etc/rc.local

hdparm -S 242 /dev/sda
hdparm -S 242 /dev/sdb


Partition

Use fdisk -u to make the parition by sectors.

Use the 'n' option to create a new partition.

Start at sector 64 (devisable by 8) and continue to the end of the disk.

Use the 't' option to change the partition to type 'fd'.

Use the 'w' option to write the partition table out, and quit.

Test the speed:
sudo /sbin/hdparm -tT /dev/sda1
sudo hdparm -tT /dev/sda2


RAID

Create the RAID1 (mirror set)
sudo /sbin/mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sd[ab]1

Check it looks ok - possably echo that into /etc/mdadm/mdadm.conf:
sudo /sbin/mdadm --examine --brief --scan --config=partitions

Test the speed:
sudo /sbin/hdparm -tT /dev/md1


LVM

Initalise the Physical Volume:
sudo /sbin/pvcreate /dev/md1

Test:
sudo /sbin/pvdisplay

Create the Volume Group:
sudo /sbin/vgcreate -s 16M lvm-raid1_md1 /dev/md1

Test:
sudo /sbin/vgdisplay lvm-raid1_md1

Create the Logical Volume:
sudo /sbin/lvcreate -l 100%FREE lvm-raid1_md1 -n media

Test:
sudo /sbin/lvdisplay /dev/lvm-raid1_md1/media


XFS

Create XFS partition:
sudo /sbin/mkfs.xfs -l internal,lazy-count=1 -d agcount=4 -b size=4096 /dev/lvm-raid1_md1/media

Mount - edit /etc/fstab:
/dev/lvm-raid1_md1/media /media/media xfs defaults 0 2


VeryQuickWiki Version 2.8.1 | Admin

All contents copyright mdsh.com (C) 2011-2023.