Showing posts with label ZFS Storage. Show all posts
Showing posts with label ZFS Storage. Show all posts

Monday, October 5, 2009

ZFS tutorial using files instead of disks

Using Files
To use files on an existing filesystem, create four 128 MB files, eg.:

# mkfile 128m /home/ocean/disk1
# mkfile 128m /home/ocean/disk2
# mkfile 128m /home/ocean/disk3
# mkfile 128m /home/ocean/disk4

# ls -lh /home/ocean
total 1049152
-rw------T 1 root root 128M Mar 7 19:48 disk1
-rw------T 1 root root 128M Mar 7 19:48 disk2
-rw------T 1 root root 128M Mar 7 19:48 disk3
-rw------T 1 root root 128M Mar 7 19:48 disk4

This is easy for testing you don't need real disks or partitions
(source: http://flux.org.uk/howto/solaris/zfs_tutorial_01)

Sunday, September 6, 2009

Find missing zpool

I replaced my OS disk and now only the rpool was visible using zpool status. In order to see other existing pools run zpool import without options:

# zpool import
  pool: dawpool
    id: 8233866255479348343
state: ONLINE
status: The pool was last accessed by another system.
action: The pool can be imported using its name or numeric identifier and
        the '-f' flag.
   see: http://www.sun.com/msg/ZFS-8000-EY
config:

        dawpool     ONLINE
          raidz1    ONLINE
            c8t0d0  ONLINE
            c8t1d0  ONLINE
            c8t2d0  ONLINE
        spares
          c8t3d0

There it is again my raidz pool ready to be imported

Wednesday, August 12, 2009

Create raidz pool dawpool with 3 disks with hot spare

I bought 4 samsung 1TB disks with 32M cache to build a raidz storage consisting of 3 disks with a hot spare:

After i finished installing the disks in my server it was time to discover the new disks:

root@dawbckup:~# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c0d1
/pci@0,0/pci-ide@6/ide@0/cmdk@1,0
1. c5d0
/pci@0,0/pci-ide@9/ide@0/cmdk@0,0
2. c5d1
/pci@0,0/pci-ide@9/ide@0/cmdk@1,0
3. c6d0
/pci@0,0/pci-ide@9/ide@1/cmdk@0,0
4. c6d1
/pci@0,0/pci-ide@9/ide@1/cmdk@1,0
Specify disk (enter its number): ^C

We see c0d1 as OS disk holding OpenSolaris

root@dawbckup:~# zpool create dawpool raidz c5d0 c5d1 c6d0 spare c6d1
root@dawbckup:~#

root@dawbckup:~# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
dawpool 2.72T 1.22M 2.72T 0% ONLINE -
rpool 20G 7.53G 12.5G 37% ONLINE -
root@dawbckup:~# zpool status
pool: dawpool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
dawpool ONLINE 0 0 0
raidz1 ONLINE 0 0 0
c5d0 ONLINE 0 0 0
c5d1 ONLINE 0 0 0
c6d0 ONLINE 0 0 0
spares
c6d1 AVAIL

errors: No known data errors

pool: rpool
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c0d1s0 ONLINE 0 0 0

errors: No known data errors
root@dawbckup:~#

root@dawbckup:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
dawpool 95.2K 1.78T 25.3K /dawpool
rpool 9.41G 10.3G 78K /rpool
rpool/ROOT 5.61G 10.3G 18K legacy
rpool/ROOT/be_name 5.51G 10.3G 3.37G /
rpool/ROOT/nfo2 57K 10.3G 2.94G /
rpool/ROOT/nfo_setup 39K 10.3G 2.24G /
rpool/ROOT/nfo_static 60K 10.3G 3.07G /
rpool/ROOT/opensolaris 82.6M 10.3G 2.81G /
rpool/ROOT/opensolaris-1 24.8M 10.3G 3.33G /
rpool/dump 1.87G 10.3G 1.87G -
rpool/export 39.8M 10.3G 19K /export
rpool/export/home 39.8M 10.3G 19K /export/home
rpool/export/home/admin 39.8M 10.3G 39.8M /export/home/admin
rpool/swap 1.87G 12.2G 66K -
root@dawbckup:~# zfs create -V 1700G dawpool/backup
root@dawbckup:~#


root@dawbckup:~# zfs get shareiscsi dawpool
NAME PROPERTY VALUE SOURCE
dawpool shareiscsi off default
root@dawbckup:~#
root@dawbckup:~# zfs set shareiscsi=on dawpool
root@dawbckup:~# zfs get shareiscsi dawpool
NAME PROPERTY VALUE SOURCE
dawpool shareiscsi on local
root@dawbckup:~# iscsitadm list target -v
Target: dawpool/backup
iSCSI Name: iqn.1986-03.com.sun:02:....7c64-....-....-....-....3cd75dac
Alias: dawpool/backup
Connections: 0
ACL list:
TPGT list:
LUN information:
LUN: 0
GUID: 0
VID: SUN
PID: SOLARIS
Type: disk
Size: 1.7T
Backing store: /dev/zvol/rdsk/dawpool/backup
Status: online
root@dawbckup:~#

I fired up the MS ISCSI service in my workstation and it was recognized in diskmanagement

I added as one drive of 1700G and performed a full format (no Quick Format):
Format NTFS with 64K at 17:15 finished 1700GB at (20% in 15 min)

Tuesday, May 5, 2009

ZFS Alerting

http://en.wikibooks.org/wiki/System_Monitoring_with_Hobbit/HOWTO#Hobbit_Client_and_ZFS_monitoring

Check which disk are in the system and ID’s given by Solaris:
bash-3.00# metastat |tail -3
Device Reloc Device ID
c0t1d0 Yes id1,sd@SSEAGATE_ST336607LSUN36G_3JA6ECDF00007418PJ5V
c0t0d0 Yes id1,sd@SSEAGATE_ST336607LSUN36G_3JA6EGFK00007418A7PM
bash-3.00#

bash-3.00# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@1c,600000/scsi@2/sd@0,0
1. c0t1d0
/pci@1c,600000/scsi@2/sd@1,0
2. c0t2d0
/pci@1c,600000/scsi@2/sd@2,0
3. c0t3d0
/pci@1c,600000/scsi@2/sd@3,0


Show Health
# bash-3.00# zpool list -H
# mypool 33.8G 84.5K 33.7G 0% ONLINE -
# bash-3.00#


Script that sends an email out to redalert
This the script (run as root via crontab) I use to have an email sent
to 'root' if a fault is detected. It has already reported a fault:

#!/bin/sh
REPORT=/tmp/faultreport.txt
SYSTEM=$1
rm -f $REPORT
/usr/sbin/fmadm faulty 2>&1 > $REPORT
if test -s $REPORT
then
/usr/bin/Mail -s "$SYSTEM Fault Alert" redalert < $REPORT
fi
rm -f $REPORT

Setup ZFS iSCSI

Created an array
bash 3.2# zpool create daw c1t1d0

root@dawbkup:~# zfs set shareiscsi=on daw
root@dawbkup:~# zfs get shareiscsi daw

NAME PROPERTY VALUE SOURCE
daw shareiscsi on local

zfs create -V 120G daw/backup
[any zvols (not filesystems, I checked) created under daw will automatically become LUNs]

Ignore the following eror Probably caused by the fact I forgot to import from categorie Storage the "storage-san" package
root@dawbkup:~# zfs set shareiscsi=on daw/backup
cannot share 'daw/backup': iscsitgtd failed request to share

zfs set shareiscsi=on daw/backup

root@dawbkup:~# iscsitadm list target -v

Target: daw/backup
iSCSI Name: iqn.1986-03.com.sun:02:aa46a269-bef7-4432-9ed2-9890738fc784
Alias: daw/backup

After this I downloaded the Iscsi Initiator for windows XP and used the instructions from Microsoft. At the end the volume is shown when you go to My computer -> Manage -> Disk management. You now can create partitions add drive letters and format just like a regular disk within Windows.