# ZFS: raidz1-0 = raidz?



## LmaoTheKid (Oct 26, 2011)

Hi everyone,

I feel pretty dumb for asking this and I've searched all over.

I just created a brand new RAIDZ array with my 4 hard drives using this command:

[cmd=]zpool create datastore raidz /dev/da0 /dev/da1 /dev/da2 /dev/da3[/cmd]

When I do a *zpool status* this is what I get (9.0 RC1)

```
pool: datastore
 state: ONLINE
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        datastore   ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            da0     ONLINE       0     0     0
            da1     ONLINE       0     0     0
            da2     ONLINE       0     0     0
            da3     ONLINE       0     0     0
```

Am I ok here? Is raidz1-0 the same as regular old raidz1? These disks have been used in OpenSolaris machines and a previous FreeBSD ZFS array and I erase them every time. At one time I had them set up in a RAIDZ10 array so maybe something isnt being properly erased?

I run this command on each disk to clean them off before I create the array:
[cmd=]dd if=/dev/zero of=/dev/DISK bs=1m count=1[/cmd]

Thanks for any help!


----------



## Sebulon (Oct 26, 2011)

Hi,

raidz1-0 is just a numeric identifier for "the first raidz vdev". If you were to add another raidz vdev, that would be called raidz1-1.

Also, the first MB usually isnÂ´t enough to make it "forget" what was on it, at least not in my experience. IÂ´ve written a simple tool to automate this particular type of cleaning.

`# touch /usr/local/bin/cleandrives`
`# ee /usr/local/bin/cleandrives`
Paste in:

```
#!/bin/sh

if [ -z "$1" ]
  then
    echo "Usage: `basename $0` drive1 drive2 ..."
  exit
fi

drives="$*"

verifydrives()
  {
    for drive in $drives
      do
        if [ `ls -l /dev/ | grep -w $drive | wc -l` = "0" ]
          then
            echo "Drive $drive does not exist. Aborting."
            exit
          else
            echo "Drive $drive verified."
        fi
      done
  }

seeksector()
  {
    blocksize=`dmesg | grep -w $drive | grep -oe '[0-9]\{8,\}'`
    mbsize=`echo "$blocksize / 2048" | bc`
    echo "$mbsize - 10" | bc
  }

cleandrives()
  {
    for drive in $drives
      do
        dd if=/dev/zero of=/dev/$drive bs=1M count=10 >/dev/null 2>&1
        dd if=/dev/zero of=/dev/$drive bs=1M count=10 seek=`seeksector $drive` >/dev/null 2>&1
    done
  }

verifydrives $drives

echo ""
echo "This will irreversibly destroy partition- and filesystem data on drive(s):"
echo "$drives"
echo ""
echo "USE WITH EXTREME CAUTION!"
read -r -p 'Do you confirm "yes/no": ' choice
  case "$choice" in
    yes) cleandrives $drives
         echo ""
         echo "Drive(s) cleaned."  ;;
     no) echo ""
         echo "Cleaning cancelled."; break ;;
      *) echo ""
         echo "Cleaning cancelled."; break ;;
  esac
```
And then make executable with:
`# chmod 755 /usr/local/bin/cleandrives`

And it will erase the first- and last 10MB of any hard drive of your choosing. Just be careful to type the *correct disk*, it doesnÂ´t have any undo

/Sebulon


----------



## LmaoTheKid (Oct 26, 2011)

You're awesome, thanks so much!


----------



## Sfynx (Oct 27, 2011)

I noticed this too, in 8.2-RELEASE they would all be called the same (raidz1)


----------



## Sebulon (Oct 27, 2011)

@Sfynx

Correct. The difference is the zpool version. 8.2-RELEASE has V15, while 8-STABLE and up has V28

/Sebulon


----------

