2010-08-25

simple zfs snapshot demo

create a zfs file system on four disks
root@sol10u8 /# zpool create zzz c2t0d0 c2t1d0 c3t0d0 c3t1d0
root@sol10u8 /# zfs create zzz/data42


populate it with 2MB of data
root@sol10u8 /# dd if=/dev/urandom of=/zzz/data42/file2MB count=2048 bs=1024
2048+0 records in
2048+0 records out


verify the used disk space is 2MB
root@sol10u8 /# zfs list -o space
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
zzz 7.81G 2.11M 0 23K 0 2.09M
zzz/data42 7.81G 2.02M 0 2.02M 0 0


add 3MB
root@sol10u8 /# dd if=/dev/urandom of=/zzz/data42/file3MB count=3072 bs=1024
3072+0 records in
3072+0 records out


wait a couple of seconds, then verify usage of diskspace
2MB + 3MB = 5MB
root@sol10u8 /# zfs list -o space
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
zzz 7.81G 5.12M 0 23K 0 5.10M
zzz/data42 7.81G 5.03M 0 5.03M 0 0


create a snapshot to preserve this 5MB forever
root@sol10u8 /# zfs snapshot zzz/data42@Wednesday


snapshot = read only copy
snapshot = takes almost zero diskspace when created
snapshot = consumes diskspace as data changes
snapshot = because it keeps the original data

verify diskspace used by snapshot
root@sol10u8 /# zfs list -o space
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
zzz 7.81G 5.12M 0 23K 0 5.10M
zzz/data42 7.81G 5.03M 0 5.03M 0 0
zzz/data42@Wednesday - 0 - - - -


force 3MB of data changes on the original file system
root@sol10u8 /# dd if=/dev/urandom of=/zzz/data42/file3MB count=3072 bs=1024
3072+0 records in
3072+0 records out


this new 3MB of data was written over 3MB of existing data

wait a couple of seconds!!
then verify disk usage of file system and snapshot
root@sol10u8 /# zfs list -o space
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
zzz 7.81G 8.15M 0 23K 0 8.13M
zzz/data42 7.81G 8.05M 3.02M 5.03M 0 0
zzz/data42@Wednesday - 3.02M - - - -


notice that the snapshot uses 3MB --> it's keeping the original 3MB forever!
notice that the zpool consumes 8MB : 5MB of current data + 3MB snapshot data

copying the snapshot to another file system would total to 5MB
the same 5MB that existed at the time we took the snapshot
3MB inside the snapshot + 2MB of original data still on zzz/data42

add another 4MB of data to the file system
root@sol10u8 /# dd if=/dev/urandom of=/zzz/data42/file4MB count=4096 bs=1024
4096+0 records in
4096+0 records out


wait a couple of seconds
verify that data42 now consumes 9MB
snapshot stays at 3MB
total for the pool is now 12 MB
12MB = 3MB snapshot + 2MB original data + 3MB new data + 4MB new data
root@sol10u8 /# zfs list -o space
NAME AVAIL USED USEDSNAP USEDDS USEDREFRESERV USEDCHILD
zzz 7.80G 12.2M 0 23K 0 12.1M
zzz/data42 7.80G 12.1M 3.02M 9.03M 0 0
zzz/data42@Wednesday - 3.02M - - - -


this new 4MB data is in a new file, so it does not influence the snapshot

take a look at the file system
root@sol10u8 /# ls -l /zzz/data42/
total 18457
-rw-r--r-- 1 root root 2097152 Aug 25 21:45 file2MB
-rw-r--r-- 1 root root 3145728 Aug 25 21:49 file3MB
-rw-r--r-- 1 root root 4194304 Aug 25 21:51 file4MB


take a look at the snapshot
root@sol10u8 /# ls -l /zzz/data42/.zfs/snapshot/Wednesday/
total 10256
-rw-r--r-- 1 root root 2097152 Aug 25 21:45 file2MB
-rw-r--r-- 1 root root 3145728 Aug 25 21:46 file3MB


notice the difference in the time stamp on the 3MB file!!

use zfs send/receive to copy the snapshot
zfs send zzz/data42@Wednesday | ssh server "zfs receive yyy/data42"


or use cp, tar, cpio, rsync... to backup a snapshot
www.linux-training.be explains these commands

destroy the snapshot
zfs destroy zzz/data42@Wednesday

2010-08-22

Impressions on Oracle

There are enough blogposts mourning OpenSolaris (or hoping for Illumos). What follows are some real world experiences in dealing with Oracle since it took over the Sun Solaris trainings in Belgium.

1. Remote labs are free!
Solaris teachers and students can now connect to remote labs with nice hardware for free. This is a great addition to the simple Intel machines in the classroom.

2. Support is excellent!
In the weeks prior to the first Oracle Solaris training several people from Oracle called and/or emailed me to make sure everything was okay. These are real people that don't mind sharing their real email address and their real phone number. Cool! And they were very friendly and helpful!

3. Support is excellent!
When sending an email on Sunday to report a problem, there is an almost immediate response from one of these real people. On a Sunday?! Super cool!