{"id":803,"date":"2010-03-12T16:10:16","date_gmt":"2010-03-12T21:10:16","guid":{"rendered":"http:\/\/www.gamescheat.ca\/?p=803"},"modified":"2019-09-04T19:57:39","modified_gmt":"2019-09-05T00:57:39","slug":"803","status":"publish","type":"post","link":"http:\/\/www.gamescheat.ca\/?p=803","title":{"rendered":"How to rebuild a Solaris 10 server using the ZFS Root Pool Snapshots"},"content":{"rendered":"<p>Solaris 10 has provides the ability to recover from a disk drive failure using ZFS root pool snapshots.  The snapshot can also be used to quickly rebuild a new server in the event of a disaster.  Snapshot is different from flash archive which can also be used to rebuild a server.  If the flash archive contains an image of a ZFS filesystem then it can only be restored via a JumStart server.   Flash archive of UFS filesystems can be restored after booting up with the Solaris 10 installation CD.<\/p>\n<p>I will explain how to create a ZFS root pool snapshot and the steps to restore it to new hardware.   This is a tried and tested procedure which I created.  I could not find a complete documentation to do this on the internet, this took me a few days to figure out.<\/p>\n<p>First create a NFS share on the remote server to store the snapshots.  Let\u2019s call this server remote-server.<\/p>\n<p>For example create a filesystem.<\/p>\n<blockquote><p># zfs create rpool\/snaps<\/p><\/blockquote>\n<p>Share rpool\/snaps.<\/p>\n<blockquote><div style=\"float: right;\"><div style=\"margin: 15px 15px 15px 15px\";><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"pub-3319935785736004\";\ngoogle_alternate_color = \"FFFFFF\";\ngoogle_ad_width = 300;\ngoogle_ad_height = 250;\ngoogle_ad_format = \"300x250_as\";\ngoogle_ad_type = \"text_image\";\ngoogle_ad_channel =\"\";\ngoogle_color_border = \"cccccc\";\ngoogle_color_link = \"cc0000\";\ngoogle_color_bg = \"ffffff\";\ngoogle_color_text = \"000000\";\ngoogle_color_url = \"008000\";\n\/\/--><\/script>\n<script type=\"text\/javascript\"\n  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/div><\/div><p># zfs set sharenfs=rw rpool\/snaps<\/p><\/blockquote>\n<p>Check to see if share created properly.<\/p>\n<blockquote><p># share<br \/>\n\u2013               \/rpool\/snaps   rw   \u201c\u201d          \u201c\u201d  <\/p><\/blockquote>\n<p>To create a recursive snapshot of the root pool on the server you wish to backup, logon as root.  For this exercise let\u2019s call this server prod-server.<\/p>\n<p>List the current ZFS filesystems.<\/p>\n<blockquote><p># zfs list<br \/>\nNAME                                   USED  AVAIL  REFER  MOUNTPOINT<br \/>\nrpool                                    7.43G  41.1G    97K    \/rpool<br \/>\nrpool\/ROOT                           4.43G  41.1G    21K    legacy<br \/>\nrpool\/ROOT\/s10s_u8wos_08a   4.43G  41.1G  4.36G   \/<br \/>\nrpool\/ROOT\/s10s_u8wos_08a\/var  69.1M  41.1G  69.1M  \/var<br \/>\nrpool\/dump                           1.00G  41.1G  1.00G  \u2013<br \/>\nrpool\/export                         44K  41.1G    23K  \/export<br \/>\nrpool\/export\/home                 21K  41.1G    21K  \/export\/home<br \/>\nrpool\/swap                           2G  43.1G    16K  \u2013                <\/p><\/blockquote>\n<p>Create recursive snapshots of the root pool.<\/p>\n<blockquote><p># zfs snapshot \u2013r rpool@backup<\/p><\/blockquote>\n<p>List the ZFS filesystems, you should see the snapshots.<\/p>\n<blockquote><p># zfs list<br \/>\nNAME                                                   USED  AVAIL  REFER  MOUNTPOINT<br \/>\nrpool                                                    7.43G  41.1G    97K  \/rpool<br \/>\nrpool@backup                                        0      \u2013    97K  \u2013<br \/>\nrpool\/ROOT                                           4.43G  41.1G    21K  legacy<br \/>\nrpool\/ROOT@backup                               0      \u2013    21K  \u2013<br \/>\nrpool\/ROOT\/s10s_u8wos_08a                   4.43G  41.1G  4.36G  \/<br \/>\nrpool\/ROOT\/s10s_u8wos_08a@backup       244K      \u2013  4.36G  \u2013<br \/>\nrpool\/ROOT\/s10s_u8wos_08a\/var             69.2M  41.1G  69.1M  \/var<br \/>\nrpool\/ROOT\/s10s_u8wos_08a\/var@backup  40.5K      \u2013  69.1M  \u2013<br \/>\nrpool\/dump                                           1.00G  41.1G  1.00G  \u2013<br \/>\nrpool\/dump@backup                               0      \u2013  1.00G  \u2013<br \/>\nrpool\/export                                         44K  41.1G    23K  \/export<br \/>\nrpool\/export@backup                       0      \u2013    23K  \u2013<br \/>\nrpool\/export\/home                         21K  41.1G    21K  \/export\/home<br \/>\nrpool\/export\/home@backup                  0      \u2013    21K  \u2013<br \/>\nrpool\/swap                              2.00G  43.1G    16K  \u2013<br \/>\nrpool\/swap@backup                         0      \u2013    16K  \u2013               <\/p><\/blockquote>\n<p>Send the root pool snapshot to remote-server.<\/p>\n<blockquote><p>#Zfs send \u2013Rv rpool@backup > \/net\/remote-server\/rpool\/snaps\/rpool.backup<\/p><\/blockquote>\n<p>On the server you wish to restore the snapshot to, boot up with the Solaris installation CD in single user mode.<\/p>\n<blockquote><p>ok boot cdrom \u2013s<\/p><\/blockquote>\n<p>Configure the NIC<\/p>\n<blockquote><p># ifconfig bge0 10.55.99.22 netmask 255.255.0.0 up<\/p><\/blockquote>\n<p>Mount NFS share on remote-server using remote server\u2019s IP.<\/p>\n<blockquote><p># mount -f nfs 10.55.99.33:\/rpool\/snaps \/mnt<\/p><\/blockquote>\n<p>If the disk drive is new then ensure it is labeled as SMI and a slice 0 exist.  This slice needs to be big enough to restore to.  Use format \u2013e command to create the slices and label the disk.<\/p>\n<blockquote><p>#format \u2013e<br \/>\nSelect disk number,  partition, print.<br \/>\nA SMI labeled disk should look similar to the below example.<\/p>\n<p>Current partition table (original):<br \/>\nTotal disk cylinders available: 65533 + 2 (reserved cylinders)              <\/p>\n<p>Part      Tag    Flag     Cylinders         Size            Blocks<br \/>\n  0       root    wm       0 \u2013  9262       49.43GB    (9263\/0\/0)  103652970<br \/>\n  1 unassigned    wm       0                0         (0\/0\/0)             0<br \/>\n  2     backup    wm       0 \u2013 65532      349.67GB    (65533\/0\/0) 733314270<br \/>\n  3 unassigned    wm       0                0         (0\/0\/0)             0<br \/>\n  4 unassigned    wm       0                0         (0\/0\/0)             0<br \/>\n  5 unassigned    wm       0                0         (0\/0\/0)             0<br \/>\n  6 unassigned    wm       0                0         (0\/0\/0)             0<br \/>\n  7 unassigned    wm    9263 \u2013 65532      300.25GB    (56270\/0\/0) 629661300 <\/p><\/blockquote>\n<p>Create the ZFS root pool.  C0t0d0 is the disk and the S0 at the end is slice 0.<\/p>\n<blockquote><p>#zpool create -f -o failmode=continue -R \/a -m legacy -o cachefile=\/etc\/zfs\/zpool.cache rpool c0t0d0s0<\/p><\/blockquote>\n<p>Check to see if the pool was created.<\/p>\n<blockquote><p># zpool list<br \/>\nNAME      SIZE   USED  AVAIL    CAP  HEALTH  ALTROOT<br \/>\nrpool    49.2G  5.45G  43.8G    11%  ONLINE  \u2013        <\/p><\/blockquote>\n<p>Restore the root pool snapshot.  This step will take some time depending on the size of the snapshot.<\/p>\n<blockquote><p># cat \/mnt\/rpool.backup | zfs receive -Fdu rpool<\/p><\/blockquote>\n<p>Check to see if the restore was successful.<\/p>\n<blockquote><p># zfs list<br \/>\nNAME                                    \t\t\t USED  AVAIL  REFER  MOUNTPOINT<br \/>\nrpool                                   \t\t\t5.43G   128G    97K  \/a\/rpool<br \/>\nrpool@backup                              \t\t0      \u2013    97K  \u2013<br \/>\nrpool\/ROOT                              \t\t4.43G   128G    21K  legacy<br \/>\nrpool\/ROOT@backup                         \t\t0      \u2013    21K  \u2013<br \/>\nrpool\/ROOT\/s10s_u8wos_08a              \t\t 4.43G   128G  4.36G  \/a<br \/>\nrpool\/ROOT\/s10s_u8wos_08a@backup          \t0      \u2013  4.36G  \u2013<br \/>\nrpool\/ROOT\/s10s_u8wos_08a\/var           \t69.1M   128G  69.1M  \/a\/var<br \/>\nrpool\/ROOT\/s10s_u8wos_08a\/var@backup      \t0      \u2013  69.1M  \u2013<br \/>\nrpool\/dump                              \t\t1.00G   128G  1.00G  \u2013<br \/>\nrpool\/dump@backup                         \t\t0      \u2013  1.00G  \u2013<br \/>\nrpool\/export                            \t \t\t 44K   128G    23K  \/a\/export<br \/>\nrpool\/export@backup                       \t\t0      \u2013    23K  \u2013<br \/>\nrpool\/export\/home                        \t\t 21K   128G    21K  \/a\/export\/home<br \/>\nrpool\/export\/home@backup                  \t0      \u2013    21K  \u2013<br \/>\nrpool\/swap                                \t\t16K   128G    16K  \u2013<br \/>\nrpool\/swap@backup                         \t\t0      \u2013    16K  \u2013     <\/p><\/blockquote>\n<p>Set the bootfs property on the root pool BE.<\/p>\n<blockquote><p>#zpool set bootfs=rpool\/ROOT\/s10s_u8wos_08a rpool<\/p><\/blockquote>\n<p>Determine the platform name, you will need it for the next step.<\/p>\n<blockquote><p># uname -i<br \/>\nSUNW,SPARC-Enterprise     <\/p><\/blockquote>\n<p>Install the boot blocks on the new disk, insert the result of uname -i.  On a SPARC server.<\/p>\n<blockquote><p>#installboot -F zfs \/usr\/platform\/SUNW,SPARC-Enterprise\/lib\/fs\/zfs\/bootblk \/dev\/rdsk\/ c0t0d0s0<\/p><\/blockquote>\n<p>On an x86 server. Note, I only tested my procedures on a SPARC server, but it should work on a x86 server as well.<\/p>\n<blockquote><p># installgrub \/boot\/grub\/stage1 \/boot\/grub\/stage2 \/dev\/rdsk\/c0t0d0s0<\/p><\/blockquote>\n<p>You are done, reboot the system.<\/p>\n<blockquote><p>#init 6<\/p><\/blockquote>\n<p>If the server does not boot up, then ensure that the disk you choose is the default boot device.  If you need to find out how to do that then see this article, <a href=\"http:\/\/www.gamescheat.ca\/2010\/03\/changing-the-default-boot-device-on-a-sparc-server\/\">http:\/\/www.gamescheat.ca\/2010\/03\/changing-the-default-boot-device-on-a-sparc-server\/<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Solaris 10 has provides the ability to recover from a disk drive failure using ZFS root pool snapshots. The snapshot can also be used to quickly rebuild a new server in the event of a disaster. Snapshot is different from&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.gamescheat.ca\/?p=803\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[64,74,75],"_links":{"self":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/803"}],"collection":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=803"}],"version-history":[{"count":5,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions"}],"predecessor-version":[{"id":967,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions\/967"}],"wp:attachment":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}