Sunday, October 26, 2014

How to Replace disk on freenas for CLI

[root@freenas] ~# camcontrol identify ada0 | grep LBA48
LBA48 supported       5860533168 sectors
[root@freenas] ~# camcontrol identify ada2 | grep LBA48
LBA48 supported       5860533168 sectors
[root@freenas] ~#
[root@freenas] ~# smartctl -a /dev/ada1 | grep "Serial"
Serial Number:    W1F390KB
[root@freenas] ~# smartctl -a /dev/ada2 | grep "Serial"
Serial Number:    WCC1T1236411
[root@freenas] ~# smartctl -a /dev/ada0 | grep "Serial"
Serial Number:    W1F3M4FP
[root@freenas] ~#


[root@freenas] ~# cat /etc/version
FreeNAS-8.3.2-RELEASE-x86 (r12686+70c2cb8)


[root@freenas] ~# camcontrol devlist sysctl kern.disks
          at scbus0 target 0 lun 0 (pass0,ada0)
          at scbus1 target 0 lun 0 (pass1,ada1)
        at scbus2 target 0 lun 0 (pass2,ada2)
          at scbus3 target 0 lun 0 (pass3,ada3)
          at scbus4 target 0 lun 0 (pass4,ada4)
          at scbus5 target 0 lun 0 (pass5,ada5)
    at scbus8 target 0 lun 0 (pass6,da0)

[root@freenas] ~#glabel status


                                      Name  Status  Components

gptid/55414a31-55c3-11e3-b6e3-4ce676286ed3     N/A  ada0p2

gptid/55ecb111-55c3-11e3-b6e3-4ce676286ed3     N/A  ada1p2

          gpt/Microsoft reserved partition     N/A  ada2p1

gptid/fa7d0f15-3dff-4dbb-87b4-2719b856d7ad     N/A  ada2p1

gptid/573cee31-55c3-11e3-b6e3-4ce676286ed3     N/A  ada3p2

gptid/57e5235e-55c3-11e3-b6e3-4ce676286ed3     N/A  ada4p2

gptid/5877a718-55c3-11e3-b6e3-4ce676286ed3     N/A  ada5p1

gptid/58928e16-55c3-11e3-b6e3-4ce676286ed3     N/A  ada5p2

                             ufs/FreeNASs3     N/A  da0s3

                             ufs/FreeNASs4     N/A  da0s4

                            ufs/FreeNASs1a     N/A  da0s1a

gptid/ef001e5f-03b8-4b2a-867d-30b9de1d8301     N/A  zvol/nas12t/lptrungp1


[root@freenas] ~# gpart show


=>        34  5860533101  ada0  GPT  (2.7T)

          34          94        - free -  (47k)

         128     4194304     1  freebsd-swap  (2.0G)

     4194432  5856338696     2  freebsd-zfs  (2.7T)

  5860533128           7        - free -  (3.5k)



=>        34  5860533101  ada1  GPT  (2.7T)

          34          94        - free -  (47k)

         128     4194304     1  freebsd-swap  (2.0G)

     4194432  5856338696     2  freebsd-zfs  (2.7T)

  5860533128           7        - free -  (3.5k)



=>        34  5860533101  ada2  GPT  (2.7T)

          34      262144     1  ms-reserved  (128M)

      262178  5860270957        - free -  (2.7T)



=>        34  5860533101  ada3  GPT  (2.7T)

          34          94        - free -  (47k)

         128     4194304     1  freebsd-swap  (2.0G)

     4194432  5856338696     2  freebsd-zfs  (2.7T)

  5860533128           7        - free -  (3.5k)



=>        34  5860533101  ada4  GPT  (2.7T)

          34          94        - free -  (47k)

         128     4194304     1  freebsd-swap  (2.0G)

     4194432  5856338696     2  freebsd-zfs  (2.7T)

  5860533128           7        - free -  (3.5k)



=>        34  5860533101  ada5  GPT  (2.7T)

          34          94        - free -  (47k)

         128     4194304     1  freebsd-swap  (2.0G)

     4194432  5856338696     2  freebsd-zfs  (2.7T)

  5860533128           7        - free -  (3.5k)



=>      63  30945217  da0  MBR  (14G)

        63   1930257    1  freebsd  [active]  (942M)

   1930320        63       - free -  (31k)

   1930383   1930257    2  freebsd  (942M)

   3860640      3024    3  freebsd  (1.5M)

   3863664     41328    4  freebsd  (20M)

   3904992  27040288       - free -  (12G)



=>      0  1930257  da0s1  BSD  (942M)

        0       16         - free -  (8.0k)

       16  1930241      1  !0  (942M)



=>     34  4194237  zvol/nas12t/lptrung  GPT  (2.0G)

       34     2014                       - free -  (1M)

     2048  4192223                    1  !aa31e02a-400f-11db-9590-000c2911d1b8  (2G)




[root@freenas] ~# zpool status


  pool: nas12t

 state: DEGRADED

status: One or more devices could not be opened.  Sufficient replicas exist for

    the pool to continue functioning in a degraded state.

action: Attach the missing device and online it using 'zpool online'.

   see: http://www.sun.com/msg/ZFS-8000-2Q

  scan: scrub repaired 0 in 651h3m with 0 errors on Sat Aug 30 03:03:53 2014

config:



    NAME                                            STATE     READ WRITE CKSUM

    nas12t                                          DEGRADED     0     0     0

      raidz1-0                                      DEGRADED     0     0     0

        gptid/55414a31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        gptid/55ecb111-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        16889620854227218693                        UNAVAIL      0     0     0  was /dev/gptid/5694c48b-55c3-11e3-b6e3-4ce676286ed3
        gptid/573cee31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        gptid/57e5235e-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        gptid/58928e16-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0



errors: No known data errors


[root@freenas] ~# zpool  replace nas12t /dev/gptid/5694c48b-55c3-11e3-b6e3-4ce676286ed3 ada2


[root@freenas] ~# zpool status


  pool: nas12t

 state: DEGRADED

status: One or more devices is currently being resilvered.  The pool will

    continue to function, possibly in a degraded state.

action: Wait for the resilver to complete.

  scan: resilver in progress since Sun Oct 26 06:09:47 2014

        180G scanned out of 9.47T at 110M/s, 24h32m to go

        30.0G resilvered, 1.86% done

config:



    NAME                                            STATE     READ WRITE CKSUM

    nas12t                                          DEGRADED     0     0     0

      raidz1-0                                      DEGRADED     0     0     0

        gptid/55414a31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        gptid/55ecb111-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        replacing-2                                 UNAVAIL      0     0     0

          16889620854227218693                      UNAVAIL      0     0     0  was /dev/gptid/5694c48b-55c3-11e3-b6e3-4ce676286ed3

          ada2                                      ONLINE       0     0     0  (resilvering)

        gptid/573cee31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        gptid/57e5235e-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

        gptid/58928e16-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0



errors: No known data errors

Wait many hour => for complete

[root@freenas] ~# zpool status
  pool: nas12t
 state: DEGRADED
  scan: resilvered 1.58T in 14h28m with 0 errors on Sun Oct 26 20:38:20 2014
config:

        NAME                                            STATE     READ WRITE CKSUM
        nas12t                                          DEGRADED     0     0     0
          raidz1-0                                      DEGRADED     0     0     0
            gptid/55414a31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            gptid/55ecb111-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            replacing-2                                 UNAVAIL      0     0     0
              16889620854227218693                      UNAVAIL      0     0     0  was /dev/gptid/5694c48b-55c3-11e3-b6e3-4ce676286ed3
              ada2                                      ONLINE       0     0     0
            gptid/573cee31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            gptid/57e5235e-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            gptid/58928e16-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

errors: No known data errors

[root@freenas] ~# zpool detach nas12t 16889620854227218693
[root@freenas] ~# zpool status
  pool: nas12t
 state: ONLINE
  scan: resilvered 1.58T in 14h28m with 0 errors on Sun Oct 26 20:38:20 2014
config:

        NAME                                            STATE     READ WRITE CKSUM
        nas12t                                          ONLINE       0     0     0
          raidz1-0                                      ONLINE       0     0     0
            gptid/55414a31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            gptid/55ecb111-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            ada2                                        ONLINE       0     0     0
            gptid/573cee31-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            gptid/57e5235e-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0
            gptid/58928e16-55c3-11e3-b6e3-4ce676286ed3  ONLINE       0     0     0

errors: No known data errors
[root@freenas] ~#

No comments: