{"id":568,"date":"2011-12-17T16:48:05","date_gmt":"2011-12-17T16:48:05","guid":{"rendered":"http:\/\/poojanwagh.opalstacked.com\/techblog\/?p=568"},"modified":"2011-12-17T16:54:11","modified_gmt":"2011-12-17T16:54:11","slug":"creating-static-adax-mappings-for","status":"publish","type":"post","link":"https:\/\/tech.poojanblog.com\/blog\/unix-linux\/creating-static-adax-mappings-for\/","title":{"rendered":"Creating static adaX mappings for FreeBSD drives"},"content":{"rendered":"<p>I recently had a problem with ZFS. I went back to not using glabel, mainly because I wanted to force 4KB sector alignment on my drives and therefore used a gnop trick. About a month after doing so, I shuffled my drives around. I had ada4 and ada5 set up in a mirror configuration. At some point, I moved a drive around and ada4 became ada3 and ada3 became ada2. I could have (and should have) used the methods below to re-assign ada3\/ada4 to their right positions. Anyway, I&#8217;m doing it now.<\/p>\n<p><!--more--><\/p>\n<p>Here&#8217;s the controller\/bus enumeration before any changes:<\/p>\n<p><code><br \/>\nDec  3 17:05:35 server kernel: ahci0:  mem 0xfdefe000-0xfdefffff irq 17 at device 0.0 on pci2<br \/>\nDec  3 17:05:35 server kernel: ahci0: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: ahci0: AHCI v1.00 with 2 3Gbps ports, Port Multiplier supported<br \/>\nDec  3 17:05:35 server kernel: ahcich0:  at channel 0 on ahci0<br \/>\nDec  3 17:05:35 server kernel: ahcich0: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: ahcich1:  at channel 1 on ahci0<br \/>\nDec  3 17:05:35 server kernel: ahcich1: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: atapci0:  port 0xdf00-0xdf07,0xde00-0xde03,0xdd00-0xdd07,0xdc00-0xdc03,0xdb00-0xdb0f irq 18 at device<br \/>\nDec  3 17:05:35 server kernel: atapci0: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: ata2:  on atapci0<br \/>\nDec  3 17:05:35 server kernel: ata2: [ITHREAD]<br \/>\n...<br \/>\nDec  3 17:05:35 server kernel: siis0:  port 0xcf00-0xcf0f mem 0xfdcff000-0xfdcff07f,0xfdcf0000-0xfdcf7fff irq 20 at device 0.0 on pci3<br \/>\nDec  3 17:05:35 server kernel: siis0: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: siisch0:  at channel 0 on siis0<br \/>\nDec  3 17:05:35 server kernel: siisch0: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: siisch1:  at channel 1 on siis0<br \/>\nDec  3 17:05:35 server kernel: siisch1: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: siisch2:  at channel 2 on siis0<br \/>\nDec  3 17:05:35 server kernel: siisch2: [ITHREAD]<br \/>\nDec  3 17:05:35 server kernel: siisch3:  at channel 3 on siis0<br \/>\nDec  3 17:05:35 server kernel: siisch3: [ITHREAD]<br \/>\n...Dec  3 17:11:28 server kernel: ahci1:  port 0xfa00-0xfa07,0xf900-0xf903,0xf800-0xf807,0xf700-0xf703,0xf600-0xf60f mem 0xfdffe000-0xfdff<br \/>\nDec  3 17:11:28 server kernel: ahci1: [ITHREAD]<br \/>\nDec  3 17:11:28 server kernel: ahci1: AHCI v1.10 with 4 3Gbps ports, Port Multiplier not supported<br \/>\nDec  3 17:11:28 server kernel: ahcich2:  at channel 0 on ahci1<br \/>\nDec  3 17:11:28 server kernel: ahcich2: [ITHREAD]<br \/>\nDec  3 17:11:28 server kernel: ahcich3:  at channel 1 on ahci1<br \/>\nDec  3 17:11:28 server kernel: ahcich3: [ITHREAD]<br \/>\nDec  3 17:11:28 server kernel: ahcich4:  at channel 2 on ahci1<br \/>\nDec  3 17:11:28 server kernel: ahcich4: [ITHREAD]<br \/>\nDec  3 17:11:28 server kernel: ahcich5:  at channel 3 on ahci1<br \/>\nDec  3 17:11:28 server kernel: ahcich5: [ITHREAD]<br \/>\n<\/code><\/p>\n<p>Curiously, I don&#8217;t think ahci1 (the Intel South Bridge) physically exposes all 4 channels on the motherboard. Only 2 SATA ports are available. Which doesn&#8217;t make sense, since Gigabyte explicitly put another 2-port SATA controller on the board<\/p>\n<p><code><br \/>\n# Intel SATA controller (South Bridge)<br \/>\nhint.scbus.0.at=\"ahcich2\"<br \/>\nhint.scbus.0.bus=\"0\"<br \/>\nhint.scbus.1.at=\"ahcich3\"<br \/>\nhint.scbus.1.bus=\"0\"<br \/>\n# JMicron SATA controller (Gigabyte Motherboard)<br \/>\nhint.scbus.2.at=\"ahcich0\"<br \/>\nhint.scbus.2.bus=\"0\"<br \/>\nhint.scbus.3.at=\"ahcich1\"<br \/>\nhint.scbus.3.bus=\"0\"<br \/>\n# SiiS controller (PCI slot)<br \/>\nhint.scbus.4.at=\"siisch0\"<br \/>\nhint.scbus.4.bus=\"0\"<br \/>\nhint.scbus.5.at=\"siisch1\"<br \/>\nhint.scbus.5.bus=\"0\"<br \/>\nhint.scbus.6.at=\"siisch2\"<br \/>\nhint.scbus.6.bus=\"0\"<br \/>\nhint.scbus.7.at=\"siisch3\"<br \/>\nhint.scbus.7.bus=\"0\"<br \/>\n<\/code><\/p>\n<p>Originally, I had something like:<\/p>\n<p><code><br \/>\nhint.scbus.0.at=\"ahci0\"<br \/>\nhint.scbus.0.bus=\"0\"<br \/>\n<\/code><\/p>\n<p>However, it seems like a &#8220;bus&#8221; as defined by hit.scbus isn&#8217;t the same as a SATA port. The system seems to enumerate all the SATA ports (from many controllers) on the same driver as ahcich0, ahcich1, etc.<\/p>\n<p>Anyway, I rebooted and found that the above works<\/p>\n<p><code><br \/>\nada0 at ahcich2 bus 0 scbus0 target 0 lun 0<br \/>\nada0:  ATA-8 SATA 2.x device<br \/>\nada0: 300.000MB\/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)<br \/>\nada0: Command Queueing enabled<br \/>\nada0: 1430799MB (2930277168 512 byte sectors: 16H 63S\/T 16383C)<br \/>\nada1 at ahcich3 bus 0 scbus1 target 0 lun 0<br \/>\nada1:  ATA-8 SATA 2.x device<br \/>\nada1: 300.000MB\/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)<br \/>\nada1: Command Queueing enabled<br \/>\nada1: 1907729MB (3907029168 512 byte sectors: 16H 63S\/T 16383C)<br \/>\nada2 at ahcich1 bus 0 scbus3 target 0 lun 0<br \/>\nada2:  ATA-8 SATA 2.x device<br \/>\nada2: 300.000MB\/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)<br \/>\nada2: Command Queueing enabled<br \/>\nada2: 61057MB (125045424 512 byte sectors: 16H 63S\/T 16383C)<br \/>\nada3 at siisch0 bus 0 scbus4 target 0 lun 0<br \/>\nada3:  ATA-7 SATA 1.x device<br \/>\nada3: 150.000MB\/s transfers (SATA 1.x, UDMA6, PIO 512bytes)<br \/>\nada3: 7641MB (15649200 512 byte sectors: 16H 63S\/T 15525C)<br \/>\nada4 at siisch1 bus 0 scbus5 target 0 lun 0<br \/>\nada4:  ATA-7 SATA 1.x device<br \/>\nada4: 150.000MB\/s transfers (SATA 1.x, UDMA6, PIO 512bytes)<br \/>\nada4: 7641MB (15649200 512 byte sectors: 16H 63S\/T 15525C)<br \/>\n<\/code><\/p>\n<p>You&#8217;ll notice that scbus2 is unconnected. ada1 is on scbus1 and ada2 is on scbus3. That&#8217;s where the problem arises. If I were to connect another hard drive to scbus2, it would become the new ada2 and the previous ada2 would be shifted to ada3. Here&#8217;s how to assign them non-contiguous numbers:<\/p>\n<p><code><br \/>\nhint.ada.0.at=\"scbus0\"<br \/>\nhint.ada.0.target=\"0\"<br \/>\nhint.ada.0.unit=\"0\"<br \/>\nhint.ada.1.at=\"scbus1\"<br \/>\nhint.ada.1.target=\"0\"<br \/>\nhint.ada.1.unit=\"0\"<br \/>\nhint.ada.2.at=\"scbus2\"<br \/>\nhint.ada.2.target=\"0\"<br \/>\nhint.ada.2.unit=\"0\"<br \/>\nhint.ada.3.at=\"scbus3\"<br \/>\nhint.ada.3.target=\"0\"<br \/>\nhint.ada.3.unit=\"0\"<br \/>\nhint.ada.4.at=\"scbus4\"<br \/>\nhint.ada.4.target=\"0\"<br \/>\nhint.ada.4.unit=\"0\"<br \/>\nhint.ada.5.at=\"scbus5\"<br \/>\nhint.ada.5.target=\"0\"<br \/>\nhint.ada.5.unit=\"0\"<br \/>\nhint.ada.6.at=\"scbus6\"<br \/>\nhint.ada.6.target=\"0\"<br \/>\nhint.ada.6.unit=\"0\"<br \/>\nhint.ada.7.at=\"scbus7\"<br \/>\nhint.ada.7.target=\"0\"<br \/>\nhint.ada.7.unit=\"0\"<br \/>\n<\/code><\/p>\n<p>Looks good. I get ada0, ada1, and skip ada2<\/p>\n<p><code><br \/>\nDec 17 10:24:10 server kernel: ada0 at ahcich2 bus 0 scbus0 target 0 lun 0<br \/>\nDec 17 10:24:10 server kernel: ada0:  ATA-8 SATA 2.x device<br \/>\nDec 17 10:24:10 server kernel: ada0: 300.000MB\/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)<br \/>\nDec 17 10:24:10 server kernel: ada0: Command Queueing enabled<br \/>\nDec 17 10:24:10 server kernel: ada0: 1430799MB (2930277168 512 byte sectors: 16H 63S\/T 16383C)<br \/>\nDec 17 10:24:10 server kernel: ada1 at ahcich3 bus 0 scbus1 target 0 lun 0<br \/>\nDec 17 10:24:10 server kernel: ada1:  ATA-8 SATA 2.x device<br \/>\nDec 17 10:24:10 server kernel: ada1: 300.000MB\/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)<br \/>\nDec 17 10:24:10 server kernel: ada1: Command Queueing enabled<br \/>\nDec 17 10:24:10 server kernel: ada1: 1907729MB (3907029168 512 byte sectors: 16H 63S\/T 16383C)<br \/>\nDec 17 10:24:10 server kernel: ada3 at ahcich1 bus 0 scbus3 target 0 lun 0<br \/>\nDec 17 10:24:10 server kernel: ada3:  ATA-8 SATA 2.x device<br \/>\nDec 17 10:24:10 server kernel: ada3: 300.000MB\/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)<br \/>\nDec 17 10:24:10 server kernel: ada3: Command Queueing enabled<br \/>\nDec 17 10:24:10 server kernel: ada3: 61057MB (125045424 512 byte sectors: 16H 63S\/T 16383C)<br \/>\nDec 17 10:24:10 server kernel: ada4 at siisch0 bus 0 scbus4 target 0 lun 0<br \/>\nDec 17 10:24:10 server kernel: ada4:  ATA-7 SATA 1.x device<br \/>\nDec 17 10:24:10 server kernel: ada4: 150.000MB\/s transfers (SATA 1.x, UDMA6, PIO 512bytes)<br \/>\nDec 17 10:24:10 server kernel: ada4: 7641MB (15649200 512 byte sectors: 16H 63S\/T 15525C)<br \/>\nDec 17 10:24:10 server kernel: ada5 at siisch1 bus 0 scbus5 target 0 lun 0<br \/>\nDec 17 10:24:10 server kernel: ada5:  ATA-7 SATA 1.x device<br \/>\nDec 17 10:24:10 server kernel: ada5: 150.000MB\/s transfers (SATA 1.x, UDMA6, PIO 512bytes)<br \/>\nDec 17 10:24:10 server kernel: ada5: 7641MB (15649200 512 byte sectors: 16H 63S\/T 15525C)<br \/>\n<\/code><\/p>\n<p>Another thing I ran up against was that my 2 drives are not the same size. One is a 1.5TB and one is a 2TB. When this mess happened, the system put the 2TB in the place of the 1.5 TB (I think). This would have been fine, except, I couldn&#8217;t then re-add the 1.5TB drive as a replacement for the 2TB drive as it will only accept something the same size or bigger. This has been documented before <a href=\"http:\/\/www.freebsddiary.org\/zfs-with-gpart.php\" title=\"ZFS: don't give it all your disk space\" target=\"_blank\">here<\/a>. For now, I&#8217;m throwing caution to the wind and not doing a gpart\/glabel. Maybe I&#8217;ll regret it later, but I want to try this out (ZFS native only) for now. I&#8217;ve seen quite a bit on the forums that ZFS should handle everything natively.<\/p>\n<\/p>\n<div class='wp_likes' id='wp_likes_post-568'><a class='like' href=\"javascript:wp_likes.like(568);\" title='' ><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/tech.poojanblog.com\/blog\/wp-content\/plugins\/wp-likes\/images\/like.png\" alt='' border='0'\/><\/a><span class='text'>Be the first to like.<\/span><\/p>\n<div class='like' ><a href=\"javascript:wp_likes.like(568);\">Like<\/a><\/div>\n<div class='unlike' ><a href=\"javascript:wp_likes.unlike(568);\">Unlike<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I recently had a problem with ZFS. I went back to not using glabel, mainly because I wanted to force 4KB sector alignment on my drives and therefore used a gnop trick. About a month after doing so, I shuffled my drives around. I had ada4 and ada5 set up in a mirror configuration. At [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[169,166,170,12,168,167,3],"class_list":["post-568","post","type-post","status-publish","format-standard","hentry","category-unix-linux","tag-ada","tag-ahci","tag-cam","tag-freebsd","tag-scbus","tag-siis","tag-zfs"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/568","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/comments?post=568"}],"version-history":[{"count":12,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/568\/revisions"}],"predecessor-version":[{"id":593,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/posts\/568\/revisions\/593"}],"wp:attachment":[{"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/media?parent=568"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/categories?post=568"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.poojanblog.com\/blog\/wp-json\/wp\/v2\/tags?post=568"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}