Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # FreeBSD high-speed pool setup
- # Automatically create gmultipath labels for serialized disks
- echo da{0..47} | sr xargs -n1 sh -c 'echo $( camcontrol inquiry $1 -S ) $1' /bin/sh | sed -e 's/\([^0-9]\)\([0-9]\)$/\10\2/' | awk 'D[$1]=D[$1](D[$1]?" ":"")$2{}END{for(S in D)print S,D[S]}' | sort -k2 | awk 'gsub(/da0/,"da"){}$1=sprintf("d%02u-%s",N++,substr($1,1,11))' | while read LABEL DISKS; do gmultipath status $LABEL > /dev/null 2>&1 || sudo gmultipath label $LABEL $DISKS; done
- # Results in the following sub-commands being executed
- sudo gmultipath label d00-Z4D3WM7A000 da0 da24
- sudo gmultipath label d01-Z4D3RYTJ000 da1 da25
- sudo gmultipath label d02-Z4D3RYVW000 da2 da26
- sudo gmultipath label d03-Z4D3RYTL000 da3 da27
- sudo gmultipath label d04-Z4D3RYZY000 da4 da28
- sudo gmultipath label d05-Z4D3RYQX000 da5 da29
- sudo gmultipath label d06-Z4D3WMQB000 da6 da30
- sudo gmultipath label d07-Z4D3WLV6000 da7 da31
- sudo gmultipath label d08-Z4D3WLYN000 da8 da32
- sudo gmultipath label d09-Z4D3WMA0000 da9 da33
- sudo gmultipath label d10-Z4D3RZ27000 da10 da34
- sudo gmultipath label d11-Z4D3WMLY000 da11 da35
- sudo gmultipath label d12-Z4D3WM1F000 da12 da36
- sudo gmultipath label d13-Z4D3W7M9000 da13 da37
- sudo gmultipath label d14-Z4D3WMAF000 da14 da38
- sudo gmultipath label d15-Z4D3WM45000 da15 da39
- sudo gmultipath label d16-Z4D3W7NZ000 da16 da40
- sudo gmultipath label d17-Z4D3W7QE000 da17 da41
- sudo gmultipath label d18-Z4D3VBQD000 da18 da42
- sudo gmultipath label d19-Z4D3RYSK000 da19 da43
- sudo gmultipath label d20-Z4D3RYY0000 da20 da44
- sudo gmultipath label d21-Z4D3RZ1M000 da21 da45
- sudo gmultipath label d22-Z4D3RYRQ000 da22 da46
- sudo gmultipath label d23-Z4D3W76C000 da23 da47
- # Automatically creating the cache pool from the multipath device labels
- cd /dev
- sudo zpool create cache $( \ls multipath/* | sort | awk '(A=$0)&&getline,$0=sprintf("mirror %s %s",A,$0)' )
- # Results in the following single command being executed
- sudo zpool create cache mirror multipath/d00-Z4D3WM7A000 multipath/d01-Z4D3RYTJ000 mirror multipath/d02-Z4D3RYVW000 multipath/d03-Z4D3RYTL000 mirror multipath/d04-Z4D3RYZY000 multipath/d05-Z4D3RYQX000 mirror multipath/d06-Z4D3WMQB000 multipath/d07-Z4D3WLV6000 mirror multipath/d08-Z4D3WLYN000 multipath/d09-Z4D3WMA0000 mirror multipath/d10-Z4D3RZ27000 multipath/d11-Z4D3WMLY000 mirror multipath/d12-Z4D3WM1F000 multipath/d13-Z4D3W7M9000 mirror multipath/d14-Z4D3WMAF000 multipath/d15-Z4D3WM45000 mirror multipath/d16-Z4D3W7NZ000 multipath/d17-Z4D3W7QE000 mirror multipath/d18-Z4D3VBQD000 multipath/d19-Z4D3RYSK000 mirror multipath/d20-Z4D3RYY0000 multipath/d21-Z4D3RZ1M000 mirror multipath/d22-Z4D3RYRQ000 multipath/d23-Z4D3W76C000
- # The results are a raid10 cache array
- zpool status cache
- # pool: cache
- # state: ONLINE
- # scan: none requested
- # config:
- #
- # NAME STATE READ WRITE CKSUM
- # cache ONLINE 0 0 0
- # mirror-0 ONLINE 0 0 0
- # multipath/d00-Z4D3WM7A000 ONLINE 0 0 0
- # multipath/d01-Z4D3RYTJ000 ONLINE 0 0 0
- # mirror-1 ONLINE 0 0 0
- # multipath/d02-Z4D3RYVW000 ONLINE 0 0 0
- # multipath/d03-Z4D3RYTL000 ONLINE 0 0 0
- # mirror-2 ONLINE 0 0 0
- # multipath/d04-Z4D3RYZY000 ONLINE 0 0 0
- # multipath/d05-Z4D3RYQX000 ONLINE 0 0 0
- # mirror-3 ONLINE 0 0 0
- # multipath/d06-Z4D3WMQB000 ONLINE 0 0 0
- # multipath/d07-Z4D3WLV6000 ONLINE 0 0 0
- # mirror-4 ONLINE 0 0 0
- # multipath/d08-Z4D3WLYN000 ONLINE 0 0 0
- # multipath/d09-Z4D3WMA0000 ONLINE 0 0 0
- # mirror-5 ONLINE 0 0 0
- # multipath/d10-Z4D3RZ27000 ONLINE 0 0 0
- # multipath/d11-Z4D3WMLY000 ONLINE 0 0 0
- # mirror-6 ONLINE 0 0 0
- # multipath/d12-Z4D3WM1F000 ONLINE 0 0 0
- # multipath/d13-Z4D3W7M9000 ONLINE 0 0 0
- # mirror-7 ONLINE 0 0 0
- # multipath/d14-Z4D3WMAF000 ONLINE 0 0 0
- # multipath/d15-Z4D3WM45000 ONLINE 0 0 0
- # mirror-8 ONLINE 0 0 0
- # multipath/d16-Z4D3W7NZ000 ONLINE 0 0 0
- # multipath/d17-Z4D3W7QE000 ONLINE 0 0 0
- # mirror-9 ONLINE 0 0 0
- # multipath/d18-Z4D3VBQD000 ONLINE 0 0 0
- # multipath/d19-Z4D3RYSK000 ONLINE 0 0 0
- # mirror-10 ONLINE 0 0 0
- # multipath/d20-Z4D3RYY0000 ONLINE 0 0 0
- # multipath/d21-Z4D3RZ1M000 ONLINE 0 0 0
- # mirror-11 ONLINE 0 0 0
- # multipath/d22-Z4D3RYRQ000 ONLINE 0 0 0
- # multipath/d23-Z4D3W76C000 ONLINE 0 0 0
- #
- # errors: No known data errors
- # Other minor adjustments
- sudo zfs set mountpoint=none cache
- sudo zfs create cache/d0
- sudo zfs set mountpoint=/d0 cache/d0
- # Results are a /d0 cache bucket
- df -hT
- # Filesystem Type Size Used Avail Capacity Mounted on
- # zroot/ROOT/default zfs 213G 878M 212G 0% /
- # devfs devfs 1.0K 1.0K 0B 100% /dev
- # zroot/tmp zfs 212G 120K 212G 0% /tmp
- # zroot/usr/home zfs 212G 3.0M 212G 0% /usr/home
- # zroot/usr/ports zfs 212G 96K 212G 0% /usr/ports
- # zroot/usr/src zfs 212G 96K 212G 0% /usr/src
- # zroot/var/audit zfs 212G 96K 212G 0% /var/audit
- # zroot/var/crash zfs 212G 96K 212G 0% /var/crash
- # zroot/var/log zfs 212G 464K 212G 0% /var/log
- # zroot/var/mail zfs 212G 136K 212G 0% /var/mail
- # zroot/var/tmp zfs 212G 104K 212G 0% /var/tmp
- # cache/d0 zfs 63T 96K 63T 0% /d0
Add Comment
Please, Sign In to add comment