{"id":131,"date":"2009-11-07T00:43:23","date_gmt":"2009-11-07T00:43:23","guid":{"rendered":"http:\/\/www.thowden.com.au\/?p=131"},"modified":"2009-11-07T00:43:23","modified_gmt":"2009-11-07T00:43:23","slug":"adding-new-drives-to-smeserver-as-a-raid-pair","status":"publish","type":"post","link":"https:\/\/howden.net.au\/thowden\/2009\/11\/adding-new-drives-to-smeserver-as-a-raid-pair\/","title":{"rendered":"Adding new drives to SMEServer as a raid pair"},"content":{"rendered":"<p>Adding two new 1Tbyte drives into my SMEServer v7.4 as a raid pair for backups. Made good use of the <a title=\"LVM How-To\" href=\"http:\/\/tldp.org\/HOWTO\/html_single\/LVM-HOWTO\/\">LVM How-To<\/a> (again!)<\/p>\n<p>Obviously installing the physical drives comes first and they should be recognised by the bios and then as the server booted mine were flagged as \/dev\/sda and sdb respectively.<\/p>\n<p>Because these are new drives and I am adding them rather than modding the current drives I am working in the normal console.<\/p>\n<blockquote><p>#fdisk \/dev\/sda<br \/>\n&gt;p &#8211;print the current state (should show as blank)<br \/>\n&gt;n &#8211;add a new partition<br \/>\n&gt;p &#8211;primary partition<br \/>\n&gt;1 &#8211;partition number<br \/>\n&gt;t &#8211;change the type or id of the drive<br \/>\n&gt;hex=\u00a0fd &#8211;change to Linux raid<br \/>\n&gt;p &#8211;print again the details and shows now as approx 1T lvm partition<br \/>\n&gt;w &#8211;write the partition table and exit<\/p><\/blockquote>\n<p>repeat for \/dev\/sdb<\/p>\n<blockquote><p>#shutdown -r now<\/p><\/blockquote>\n<p>Restarting the server should automatically match the two drives as a raid pair.\u00a0 Check by reading through<\/p>\n<blockquote><p>#cat \/var\/log\/dmesg<\/p><\/blockquote>\n<p>for something like this:<\/p>\n<blockquote><p>md: Autodetecting RAID arrays.<br \/>\nmd: could not bd_claim hda1.<br \/>\nmd: could not bd_claim hda2.<br \/>\nmd: could not bd_claim hdb1.<br \/>\nmd: could not bd_claim hdb2.<br \/>\nmd: autorun &#8230;<br \/>\nmd: considering sdb1 &#8230;<br \/>\nmd:\u00a0 adding sdb1 &#8230;<br \/>\nmd:\u00a0 adding sda1 &#8230;<br \/>\nmd: created md3<br \/>\nmd: bind<br \/>\nmd: bind<br \/>\nmd: running:<br \/>\nraid1: raid set md3 active with 2 out of 2 mirrors<br \/>\nmd: &#8230; autorun DONE.<\/p><\/blockquote>\n<p>Next check what is showing for LVM<\/p>\n<blockquote><p>#pvscan<\/p>\n<p>PV \/dev\/md2\u00a0\u00a0 VG main\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 lvm2 [186.19 GB \/ 64.00 MB free]<br \/>\nPV \/dev\/md3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 lvm2 [931.51 GB]<br \/>\nTotal: 2 [1.09 TB] \/ in use: 1 [186.19 GB] \/ in no VG: 1 [931.51 GB]<\/p><\/blockquote>\n<p>shows my new pair ready for inclusion in the LVM volume groups and logical volume.<\/p>\n<p>Here I ran into an annoyance with a message Insufficient Extents.<\/p>\n<p>I figure I want the whole disk and the above indicates 931.51G is free<\/p>\n<blockquote><p>lvm&gt; lvcreate \/dev\/backups -L931.51G -n backups<br \/>\n\u00a0 CTRL-c detected: giving up waiting for lock<br \/>\n\u00a0 Rounding up size to full physical extent 931.51 GB<br \/>\n\u00a0 Insufficient free extents (238466) in volume group backups: 238467 required<\/p><\/blockquote>\n<p>I have since learnt that lvm\u00a0does some rounding\u00a0and that using the &#8216;byte&#8217; size is not the best option.<\/p>\n<blockquote><p>vgdisplay<br \/>\n\u00a0 &#8212; Volume group &#8212;<br \/>\n\u00a0 VG Name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 backups<br \/>\n\u00a0 System ID<br \/>\n\u00a0 Format\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 lvm2<br \/>\n\u00a0 Metadata Areas\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1<br \/>\n\u00a0 Metadata Sequence No\u00a0 8<br \/>\n\u00a0 VG Access\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 read\/write<br \/>\n\u00a0 VG Status\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 resizable<br \/>\n\u00a0 MAX LV\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0<br \/>\n\u00a0 Cur LV\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0<br \/>\n\u00a0 Open LV\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0<br \/>\n\u00a0 Max PV\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0<br \/>\n\u00a0 Cur PV\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1<br \/>\n\u00a0 Act PV\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1<br \/>\n\u00a0 VG Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 931.51 GB<br \/>\n\u00a0 PE Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.00 MB<br \/>\n\u00a0 Total PE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 238466<br \/>\n\u00a0 Alloc PE \/ Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0 \/ 0<br \/>\n\u00a0 Free\u00a0 PE \/ Size\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 238466 \/ 931.51 GB<br \/>\n\u00a0 VG UUID\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 #######################<\/p><\/blockquote>\n<p>In the above screen the important bit is the &#8220;Total PE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 238466&#8221; which tells me the Physical Extents available.<\/p>\n<p>Changing my command to create the lv so that I use the PE rather than byte value<\/p>\n<blockquote><p>lvm&gt; lvcreate \/dev\/backups -l238466 -n backups<br \/>\n\u00a0 Logical volume &#8220;backups&#8221; created<br \/>\nlvm&gt;<\/p><\/blockquote>\n<p>gives a successful outcome.<\/p>\n<blockquote><p>lvm&gt; lvscan<br \/>\n\u00a0 ACTIVE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;\/dev\/main\/root&#8217; [184.19 GB] inherit<br \/>\n\u00a0 ACTIVE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;\/dev\/main\/swap&#8217; [1.94 GB] inherit<br \/>\n\u00a0 ACTIVE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8216;\/dev\/backups\/backups&#8217; [931.51 GB] inherit\u00a0<\/p><\/blockquote>\n<p>Next to format the new backups volume<\/p>\n<blockquote><p>#mke2fs \/dev\/backups\/backups<\/p><\/blockquote>\n<p>Add the journalling<\/p>\n<blockquote><p>#tune2fs -j \/dev\/backups\/backups<\/p><\/blockquote>\n<p>Edit fstab to add the mounting of this drive by inserting this line<\/p>\n<blockquote><p>\/dev\/backups\/backups \/backups ext3 usrquota,grpquota 1 1<\/p><\/blockquote>\n<p>and create the mount point &#8211; in my case &#8211; \/backups<\/p>\n<blockquote><p>#mkdir \/backups<\/p><\/blockquote>\n<p>Then one final restart of the server to see that it all starts ok and its done.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Installing new drives as a raid pair using LVM into an SMEServer v7.4 based on CentOS4.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[88],"class_list":["post-131","post","type-post","status-publish","format-standard","hentry","category-hardware-configuration","tag-smeserver-linux-hard-disk-drive-installation"],"_links":{"self":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":0,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/131\/revisions"}],"wp:attachment":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/categories?post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/tags?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}