Saturday, February 16, 2013

solaris ZFS cheat sheet with example

zpool create tank disk1 disk2

zpool create tank mirror disk1 disk2 mirror disk3 disk4

zpool create tank raidz disk1 disk2 disk3 disk4 

zpool status -v tank

zpool create -n tank mirror disk1 disk2 ( not create any pool but just check)

zpool destory tank (To destory the pool )

zpool add tank mirror disk1 disk2 


zpool add -n tank mirror disk1 disk2

zpool add tank raidz disk1 disk2 disk3

zpool add tank log mirror disk2 disk3 


zpool remove tank disk1 disk2  

zpool attach tank disk1 disk2

zpool attach tank disk2 disk3 ( doing 3 way mirror)

zpool detach tank disk2

zpool offline tank disk2

zpool offline -t tank disk2 ( tem offine , after reboot it become online again)

zpool online tank disk1

clearing storage pool device error

zpool clear tank

zpool clear tank disk1

replacing at same location

zpool replace tank disk1 ( If disk are of same layout)

zpool replace tank disk1 newdisk1 ( if disk are of differnt layout)

Spare pool

zpool create tank mirror disk1 disk2 spare disk3 disk4

zpool add -f tank  spare disk3 disk4


zpool remove tank disk1 ( to remove a stoarge pool )


zpool status -x tank


zpool get all tank ( To get property of pool )

zpool set autoreplace=on tank 


zpool get autoreplace tank 


To get I/O statistics

zpool iostat 

zpool iostat tank 2

zpool iostat -v 


zpool status -x 


Recover detroyed pool

zpoool destory tank

zpool import -D

zpool import -Df tank 

zpool upgrade -v ( To check the upgarde version )


Creating file system

zfs create tank/home

zfs create -o mountpoint=/export/zfs tank/home


zfs detsory tank/home



zfs destory -f tank/home

zfs renmae tank/home/maybee tank/ws/maybee

zfs list

zfs list -r pool/home/marks

zfs list /pool/home/marks

zfs list -o name,sharenfs,mountpoint

zfs set quota=50g tank/home/marks

zfs get all tank



zfs snapshot tank/home/ashu@friday ( takes only particluar snaphot)

zfs snaphot -r tank/home@friday ( Takes all the snapshot)  

zfs destroy tank/home/ashu@friday 

zfs rename tank/home/ashu@friday tank/home@today

zfs rename -r tank/home@friday tank/home@today ( All tree)


ls -ltr /tank/home/ashu/.zfs/sanpshot

zfs list -t snapshot /


zfs list -r -t snapshot -o name,creation tank/home


Rolling back snapshot

zfs rollback tank/home/ashu@friday

zfs rollback -r tank/home/ashu@friday ( -r option force delete the old snapshot)


zfs create tank/test

zfs create tank/test/productA

zfs snapshot tank/test/productA@today

zfs clone tank/test/productA@today tank/test/proudctAbeta

zfs list -r tank/test

zfs promote tank/test/productAbeta

zfs list -r tank/test


zpool scrub tank

zpool status -v tank 


zpool scrub -s tank  (Stoping the scrub)

ok boot cdrom -s

zpool import -R /a rpool

installboot -F zfs /usr/platform/'uname-i'/lib/fs/zfs/bootblk /dev/rdsk/c0t0td0s0


zfs create -V 2G rpool/swap1

swap -a /dev/zvol/dsk/rpool/swap1

swap -l


Cr



Go to /usr/share/lib/zoneinfo and do the following command:

bash# zic src/asia



As root, fire up the following command:

bash# export TZ=Asia/Jakarta



To activate the timezone at boot time, edit file /etc/TIMEZONE, change the TZ value to Asia/Jakarta

bash# ntpdate -b id.pool.ntp.org


 Run the following command in the prompt,

#rtc -z Asia/Calcutta                 ### replace "Asia/Calcutta" with your valid zonename
#rtc -c



1 comment: