{"id":6480,"date":"2017-02-11T17:10:59","date_gmt":"2017-02-11T09:10:59","guid":{"rendered":"http:\/\/rmohan.com\/?p=6480"},"modified":"2017-02-11T17:10:59","modified_gmt":"2017-02-11T09:10:59","slug":"backup-storage-centos-qnap-iscsi","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6480","title":{"rendered":"Backup storage: CentOS &#038; QNAP &#038; iSCSI"},"content":{"rendered":"<div class=\"entry-content\">\n<p>I\u2019m using a CentOS 6 box as backup server running <a href=\"http:\/\/backuppc.sourceforge.net\">BackupPC<\/a>. Until a couple days ago I had a Thecus N7700PRO NAS with 4x 3 TB discs configured as RAID5 which was accessed via iSCSI from the CentOS box. Then, 2 harddrives died at the same time (or not, at least that\u2019s what the Thecus reported at that point) and Thecus support said the system cannot see drive 1 (one of the apparently failed ones) anymore, although the Thecus still showed it, and I should try to install a new harddrive in place of drive 1 and try to duplicate all data from drive 2 to the new drive 1 using \u201cdd\u201d. When I rebooted the Thecus hoping that it might just magically work again, the whole RAID5 was gone. Like it never existed. I said screw it and bought a QNAP 19? 1U TS-412U off of eBay (new) for about 580 EUR. Along that four 4 TB enterprise discs from different vendors according to the <a href=\"http:\/\/www.qnap.com\/en\/index.php?sn=3877&amp;\">supported harddrive compatibility<\/a> list from QNAP. Here are the required steps to get the backup server back in business:<\/p>\n<p>1. Insert harddrives, power on, initial setup, QNAP will get a IP via DHCP instead of the 169.254.100.100 that\u2019s mentioned in the quick start guide.<\/p>\n<p>2. Download latest firmware from <a href=\"http:\/\/www.qnap.com\/v3\/en\/product_x_down\/product_down.php?temp_name=TS-412U\">here<\/a> and upload when prompted to.<\/p>\n<p>3. Set up RAID5 or whatever you prefer. You can only choose ext3 or ext4 but don\u2019t get confused by it, it\u2019s just the lower level that QNAP uses and on top we will later build our own XFS filesystem and use LVM.<\/p>\n<p>4. Configured iSCSI target &amp; LUN according to <a href=\"http:\/\/www.qnap.com\/index.php?lang=de&amp;sn=3501\">this QNAP link<\/a> (sorry, in German only, but the pictures should be sufficient to figure it out), but I chose Instant Allocation. You may have to wait for the RAID5 to get built before you can choose the LUN location. Also, after you created the target it may take a while before the target becomes available (you can check the progress under \u201ciSCSI Target List\u201d \u2013 \u201cAlias\u201d \u2013 \u201cid:0 \u2026\u201d \u2013 \u201cStatus\u201d).<\/p>\n<p>5. The QNAP is directly connected to eth1 on the CentOS box without a switch. eth1 has IP 192.168.1.1, the QNAP has 192.168.1.100.<\/p>\n<p>6. On the CentOS box, delete the old Thecus from the iSCSI initiator database:<br \/>\n<code>iscsiadm -m node -o delete<\/code><\/p>\n<p>7. Make sure node startup is set to automatic in <code>\/etc\/iscsi\/iscsid.conf<\/code>:<br \/>\n<code>node.startup = automatic<\/code><\/p>\n<p>8. Discover the new QNAP:<br \/>\n<code>iscsiadm -m discovery -t sendtargets -p 192.168.1.100:3260<\/code><\/p>\n<p>9. Make sure it\u2019s there:<br \/>\n<code>iscsiadm -m node<\/code><br \/>\nThis should output something like:<br \/>\n<code>192.168.1.100:3260,1 iqn.2004-04.com.qnap:ts-412u:iscsi.raid5.c8af3e<\/code><\/p>\n<p>10. If you want, reboot the box and confirm that it\u2019s still there when you execute <code>iscsiadm -m node<\/code> after the reboot.<\/p>\n<p>11. In <code>dmesg<\/code> something like this should have popped up now:<br \/>\n<code>scsi5 : iSCSI Initiator over TCP\/IP<br \/>\nscsi 5:0:0:0: Direct-Access QNAP iSCSI Storage 3.1 PQ: 0 ANSI: 5<br \/>\nsd 5:0:0:0: Attached scsi generic sg1 type 0<br \/>\nsd 5:0:0:0: [sdb] 23017373696 512-byte logical blocks: (11.7 TB\/10.7 TiB)<br \/>\nsd 5:0:0:0: [sdb] Write Protect is off<br \/>\nsd 5:0:0:0: [sdb] Mode Sense: 2f 00 00 00<br \/>\nsd 5:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA<br \/>\nsdb: unknown partition table<br \/>\nsd 5:0:0:0: [sdb] Attached SCSI disk<br \/>\n<\/code><\/p>\n<p>12. I like LVM, it\u2019s not necessary, but maybe it will be of use later on. Check with <code>pvdisplay<\/code> that <code>\/dev\/sdb<\/code> is there (maybe reboot or run <code>pvscan<\/code> if it\u2019s not):<br \/>\n\u2014 Physical volume \u2014<br \/>\nPV Name \/dev\/sdb<br \/>\n\u2026<\/p>\n<p>13. I created PV, VG and LV and assigned 100% of the available space to the LV:<br \/>\n<code>pvcreate \/dev\/sdb<br \/>\nvgcreate data \/dev\/sdb<br \/>\nlvcreate --name rz-nas01 -l100%FREE data<\/code><\/p>\n<p>14. Now, you should have <code>\/dev\/mapper\/data-rz--nas01<\/code> or <code>\/dev\/data\/rz-nas01<\/code> which are just links to a <code>\/dev\/dm-x<\/code> device. If you don\u2019t, you can try restarting <code>\/etc\/init.d\/lvm2-monitor<\/code> or just reboot. Run <code>lvdisplay<\/code> to check the LV is there and \u201cLV Status\u201d is \u201cavailable\u201d.<\/p>\n<p>15. Create a filesystem on the LV, I chose XFS:<br \/>\n<code>mkfs.xfs \/dev\/mapper\/data-rz--nas01<\/code><br \/>\nThis could take a few moments.<\/p>\n<p>16. If you want the storage to get mounted automatically on boot, use something like this in <code>\/etc\/fstab<\/code>:<br \/>\n<code>\/dev\/mapper\/data-rz--nas01 \/var\/lib\/BackupPC xfs defaults,_netdev 0 0<\/code><\/p>\n<p>17. Mount it with <code>mount \/dev\/mapper\/data-rz--nas01 \/mnt<\/code> if you want to test first, otherwise you can just do <code>mount -a<\/code>.<\/p>\n<p>18. Done!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\n<p>I\u2019m using a CentOS 6 box as backup server running BackupPC. Until a couple days ago I had a Thecus N7700PRO NAS with 4x 3 TB discs configured as RAID5 which was accessed via iSCSI from the CentOS box. Then, 2 harddrives died at the same time (or not, at least that\u2019s what the [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6480"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6480"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6480\/revisions"}],"predecessor-version":[{"id":6481,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6480\/revisions\/6481"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}