more ZFS 

more ZFS

Yesterday I got really excited with ZFS, I really wanted to know how the self healing capabilities of the damn thing worked. I found an old 3 gb disk, not huge but big enough for my purposes; it was also the first time I added a second disk to a solaris install, first created an empty configure file then turned the PC off and connected the disk, my main disk was c0d1 and the new one is c0d0.
I will repeat the process and paste most of the output and explanations or well... what I understood
root@darkstar:/export # format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
0. c0d0
/pci@0,0/pci-ide@f/ide@0/cmdk@0,0
1. c0d1
/pci@0,0/pci-ide@f/ide@0/cmdk@1,0
Specify disk (enter its number): 0
[..] /*useless output*/
format> fdisk
Total disk size is 1530 cylinders
Cylinder size is 4096 (512 byte) blocks

Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===




WARNING: no partitions are defined!

SELECT ONE OF THE FOLLOWING:
1. Create a partition
2. Specify the active partition
3. Delete a partition
4. Change between Solaris and Solaris2 Partition IDs
5. Exit (update disk configuration and exit)
6. Cancel (exit without updating disk configuration)
Enter Selection:
I pressed 1 to create a new solaris2 type partition, this one will use the whole disk and will be the active partition (I'm not going to boot from it so it's not important anyway)
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active Solaris2 1 1529 1529 100
well, I updated the configuration and left (pressing 5)
the next step is creating slices
format> partition
[..]/*useless output*/
partition> modify
Select partitioning base:
0. Current partition table (original)
1. All Free Hog
Choose base (enter number) [0]?1
Time to explain what I think I understood, slices are like partitions inside a solaris2 type partiton and the configuration I selected makes a huge slice taking all of the disk. Now this slice is only usefull when configuring other slices since they will borrow or lend space to it, for example, when I create c0d0s0, the space will be borrowed from c0d0s6, my free hog slice, the same will happen with c0d0s1 and c0d0s3, c0d0s2 represents the whole disk, that's why it occupies 2.98 gb

Part Tag Flag Cylinders Size Blocks
0 root wm 0 0 (0/0/0) 0
1 swap wu 0 0 (0/0/0) 0
2 backup wu 0 - 1526 2.98GB (1527/0/0) 6254592
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 alternates wm 1 - 2 4.00MB (2/0/0) 8192

Do you wish to continue creating a new partition
table based on above table[yes]? yes
Free Hog partition[6]?
Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]: 1.4gb
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]: 1.4gb
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]: 180m
Warning: no space available for '4' from Free Hog partition
Warning: no space available for '5' from Free Hog partition
Warning: no space available for '7' from Free Hog partition

Part Tag Flag Cylinders Size Blocks
0 root wm 3 - 719 1.40GB (717/0/0) 2936832
1 swap wu 720 - 1436 1.40GB (717/0/0) 2936832
2 backup wu 0 - 1526 2.98GB (1527/0/0) 6254592
3 unassigned wm 1437 - 1526 180.00MB (90/0/0) 368640
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 alternates wm 1 - 2 4.00MB (2/0/0) 8192

Okay to make this the current partition table[yes]?
Enter table name (remember quotes): "test"

Ready to label disk, continue? yes
partition> q
[..] /*useless output, it's the format menu actually*/
format> q
we're done creating partitions and slices, now, let's create our ZFS mirror like we did last time, but now with a real disk. and moint it in /export/test, I will turn compression on too
root@darkstar:/export # zpool create test mirror c0d0s0 c0d0s1
root@darkstar:/export # zfs set compression=on test
root@darkstar:/export # zfs set mountpoint=/export/test test
root@darkstar:/export # zpool status
pool: test
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
test ONLINE 0 0 0
mirror ONLINE 0 0 0
c0d0s0 ONLINE 0 0 0
c0d0s1 ONLINE 0 0 0
everything seems ok right now, I will copy a small file into my new ZFS filesystem nad get the md5 checksum of it
root@darkstar:/export # cp home/nacho/NVIDIA-Solaris-x86-1.0-8178.run test
root@darkstar:/export/test # digest -a md5 NVIDIA-Solaris-x86-1.0-8178.run
10c346b1dcfb5d3ee9312c1ce1c6bd24
now I will test the ZFS self healing capabilities the same way it was done in one of the ZFS introductory videos but using /dev/zero instead of /dev/random, I really just want to corrupt data and I dont really care if it is with random data or pain zeros
root@darkstar:/export/test # dd if=/dev/zero of=/dev/rdsk/c0d0s0 bs=1024 count=20480
20480+0 records in
20480+0 records out
20971520 bytes transferred in 13.288751 seconds (1578141 bytes/sec)
root@darkstar:/export # zpool export test
root@darkstar:/export # zpool import test
ZFS uses a cache, needed it to flush it and read the data from the disk to notice any changes, hence I exported and imported my ZFS pool
root@darkstar:/export # digest -a md5 test/NVIDIA-Solaris-x86-1.0-8178.run
10c346b1dcfb5d3ee9312c1ce1c6bd24
sounds like the data is still ok, let's check the status of my pool
root@darkstar:/export # zpool status
pool: test
state: ONLINE
status: One or more devices has experienced an unrecoverable error. An
attempt was made to correct the error. Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
using 'zpool online' or replace the device with 'zpool replace'.
see: http://www.sun.com/msg/ZFS-8000-9P
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
test ONLINE 0 0 0
mirror ONLINE 0 0 0
c0d0s0 ONLINE 0 0 1
c0d0s1 ONLINE 0 0 0
I really look forward to being able to boot from ZFS, it's just so easy to do these things. I think i will play some more with it

Return to Main Page

Comments

Add Comment




On This Site

  • About this site
  • Main Page
  • Most Recent Comments
  • Complete Article List
  • Sponsors

Search This Site


Syndicate this blog site

Powered by BlogEasy


Free Blog Hosting