{"id":483,"date":"2011-08-21T20:46:49","date_gmt":"2011-08-21T19:46:49","guid":{"rendered":"http:\/\/cdblog.cdstealer.com\/?p=483"},"modified":"2011-08-22T19:07:32","modified_gmt":"2011-08-22T18:07:32","slug":"raid1-setup","status":"publish","type":"post","link":"https:\/\/cdblog.cdstealer.com\/?p=483","title":{"rendered":"RAID1 setup"},"content":{"rendered":"<p>I decided it was about time I actually setup some redundancy for my data. \u00a0Having never done a full backup and only storing the odd chunk of data somewhere on a dvd. \u00a0Losing the HDD would be a severe PITA! \u00a0I purchased a <a title=\"The card\" href=\"http:\/\/www.ebuyer.com\/205769-startech-com-2-port-sata-6-gbps-pci-express-sata-controller-card-pexsat32\" target=\"_blank\">Startech PEXSAT32<\/a> and popped it in. \u00a0As my current HDD is SATA and is running under AHCI, the card was picked up out of the box.<\/p>\n<p>Before connecting any drives I ran a quick speed check (3 times) with the onboard SATA controller and got the following results.<\/p>\n<pre># hdparm -tT \/dev\/sda\r\n\/dev\/sda:\r\n Timing cached reads:   10954 MB in  2.00 seconds = 5479.70 MB\/sec\r\n Timing buffered disk reads: 264 MB in  3.01 seconds =  87.64 MB\/sec\r\n\r\n# hdparm -tT \/dev\/sda\r\n\/dev\/sda:\r\nTiming cached reads: 11060 MB in 2.00 seconds = 5533.11 MB\/sec\r\nTiming buffered disk reads: 264 MB in 3.01 seconds = 87.71 MB\/sec\r\n\r\n# hdparm -tT \/dev\/sda\r\n\/dev\/sda:\r\nTiming cached reads: 10698 MB in 2.00 seconds = 5351.98 MB\/sec\r\nTiming buffered disk reads: 262 MB in 3.02 seconds = 86.71 MB\/sec<\/pre>\n<p>Fairly poor for a SATAII controller and a SATAII drive!!!<\/p>\n<p>Time to connect the drives...<\/p>\n<p>At the risk of not losing any data and the fact that I just didn't have anything big enough to backup to, I just bought 2 x <a title=\"The Drives\" href=\"http:\/\/www.ebuyer.com\/270739-wd-1tb-caviar-green-3-5-sata-iii-6gb-s-hard-drive-64mb-wd10earx\" target=\"_blank\">WD 1TB Eco<\/a>.\u00a0 The current drive is SATAII one of these :)<\/p>\n<p>Due to the way the RAID is setup, both drives will be erased upon setup.\u00a0 This rules out cloning the original drive and building the array. The way I had to do this was to setup the RAID1 and then clone the original drive...FAIL!\u00a0 The original drive was a few blocks larger than the RAID drives :(<br \/>\nThe work around was to mirror the partitions of the original.\u00a0 This doesn't have to be an exact science, but does have to accommodate the data to be copied.\u00a0 Once the partitions have been setup (done via a Gentoo minimal CD and fdisk) it was time to start migrating data.<\/p>\n<p>I created 2 directories:<br \/>\n\/mnt\/master<br \/>\n\/mnt\/raid<\/p>\n<p>\/boot \/dev\/sda1\u00a0\u00a0\u00a0 100M<br \/>\nswap \/dev\/sda2\u00a0\u00a0\u00a0 2Gb<br \/>\n\/ \/dev\/sda3\u00a0\u00a0\u00a0 5Gb<br \/>\n\/dev\/sda4\u00a0\u00a0\u00a0 Extended partition<br \/>\n\/var \/dev\/sda5\u00a0\u00a0\u00a0 10Gb<br \/>\n\/usr \/dev\/sda6\u00a0\u00a0\u00a0 20Gb<br \/>\n\/tmp \/dev\/sda7\u00a0\u00a0\u00a0 10Gb<br \/>\n\/root \/dev\/sda8\u00a0\u00a0\u00a0 1Gb<br \/>\n\/home \/dev\/sda9\u00a0\u00a0\u00a0 870Gb<\/p>\n<p>\/dev\/sda being the original drive, I mounted the in the following order.<\/p>\n<p>mount \/dev\/sda3 \/mnt\/master<br \/>\nmount \/dev\/sda1 \/mnt\/master\/boot<br \/>\nmount \/dev\/sda5 \/mnt\/master\/var<br \/>\nmount \/dev\/sda6 \/mnt\/master\/usr<br \/>\nmount \/dev\/sda7 \/mnt\/master\/tmp<br \/>\nmount \/dev\/sda8 \/mnt\/master\/root<br \/>\nmount \/dev\/sda9 \/mnt\/master\/home<\/p>\n<p>I did the same with the raid drive (\/dev\/sdb) as above but mounted to \/mnt\/raid.<\/p>\n<p>I then executed the following to copy the data:<\/p>\n<pre dir=\"ltr\">cd \/mnt\/master\r\ntar cf - . | (cd \/mnt\/raid; tar xfp -)<\/pre>\n<p>This took quite a few hours due to the sheer amount of data.\u00a0 Although the tar command would be a little slower than say dd.\u00a0 It does allow me to copy *ALL* files from each partition, including hidden files\/folders.<\/p>\n<p>Once that completed, I powered off the machine and removed the original drive.\u00a0 Powered back up and booted into the Gentoo CD again.\u00a0 I repeated the procedure and mounted the partitions (except sda1 or \/boot).<br \/>\nNext we need to chroot into the drive's installed OS.\u00a0 cd into \/mnt\/(where you mounted the \/ partition).<br \/>\nchroot \/mnt\/(where you mounted the \/ partition) \/bin\/bash<br \/>\nenv-update<br \/>\nsource \/etc\/profile<\/p>\n<p>This has now put us into the OS installed on the drive.\u00a0 As we have only copied the OS files, we need to install grub onto the MBR.\u00a0 If you ignored me and mounted \/dev\/sda1 then you will fail and grub will complain!!<br \/>\ntype \"grub\" to enter the grub command line interface.<br \/>\ntype \"root (hd0,0)\"\u00a0 This will return the format of the file system ie 0x83<br \/>\ntype \"setup (hd0)\"\u00a0 This will return several lines of \"stage\" files if successful.<\/p>\n<p>That's it.. job done.\u00a0 Exit the chroot by typing \"exit\" and \"reboot\".<\/p>\n<p>Now... the pros and cons for me for this setup is although I now have the redundancy should a drive die, there is *NO* performance boost at all.\u00a0 Infact, upgrading to SATAIII only gained me approx 10Mb\/s increase.<\/p>\n<pre># hdparm -tT \/dev\/sda\r\n\r\n\/dev\/sda:\r\nTiming cached reads:\u00a0\u00a0 11322 MB in\u00a0 2.00 seconds = 5664.09 MB\/sec\r\nTiming buffered disk reads: 286 MB in\u00a0 3.00 seconds =\u00a0 95.26 MB\/sec\r\n\r\n# hdparm -tT \/dev\/sda\r\n\r\n\/dev\/sda:\r\nTiming cached reads:\u00a0\u00a0 10200 MB in\u00a0 2.00 seconds = 5102.15 MB\/sec\r\nTiming buffered disk reads: 272 MB in\u00a0 3.00 seconds =\u00a0 90.56 MB\/sec\r\n\r\n# hdparm -tT \/dev\/sda\r\n\r\n\/dev\/sda:\r\nTiming cached reads:\u00a0\u00a0 10500 MB in\u00a0 2.00 seconds = 5252.27 MB\/sec\r\nTiming buffered disk reads: 276 MB in\u00a0 3.02 seconds =\u00a0 91.33 MB\/sec<\/pre>\n<p>I found the below info on a forum regarding slow performance, but I also read elsewhere that SATAIII is a complete waste of time with mechanical drives.<\/p>\n<p>fdisk -H 224 -S 56 \/dev\/sdb<\/p>\n<p>running fdisk with these parameters ensures that every partition you create is aligned to 4KiB\u00a0boundaries. \u00a0I have not run the above command, this is something for me to test when I have time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I decided it was about time I actually setup some redundancy for my data. \u00a0Having never done a full backup and only storing the odd chunk of data somewhere on a dvd. \u00a0Losing the HDD would be a severe PITA! \u00a0I purchased a Startech PEXSAT32 and popped it in. \u00a0As my current HDD is SATA &hellip; <a href=\"https:\/\/cdblog.cdstealer.com\/?p=483\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">RAID1 setup<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[213,10,18,88],"class_list":["post-483","post","type-post","status-publish","format-standard","hentry","category-gentoo","tag-gentoo","tag-install","tag-linux","tag-raid"],"_links":{"self":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts\/483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=483"}],"version-history":[{"count":15,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts\/483\/revisions"}],"predecessor-version":[{"id":495,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts\/483\/revisions\/495"}],"wp:attachment":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}