Showing posts with label solaris. Show all posts
Showing posts with label solaris. Show all posts

2011-03-29

clear zfs properties

Default zfs properties can be read with zfs get.
root@sol11aa ~# zfs get -r quota rpool/mita
NAME PROPERTY VALUE SOURCE
rpool/mita quota none default
rpool/mita/jenna quota none default
rpool/mita/josep quota none default

These properties can be changed with zfs set.
root@sol11aa ~# zfs set quota=2gb rpool/mita/jenna
root@sol11aa ~# zfs get -r quota rpool/mita
NAME PROPERTY VALUE SOURCE
rpool/mita quota none default
rpool/mita/jenna quota 2G local
rpool/mita/josep quota none default

And they can be cleared by setting the property to none, but the source is now set to local instead of default.
root@sol11aa ~# zfs set quota=none rpool/mita/jenna
root@sol11aa ~# zfs get -r quota rpool/mita
NAME PROPERTY VALUE SOURCE
rpool/mita quota none default
rpool/mita/jenna quota none local
rpool/mita/josep quota none default

This local can be restored to default using zfs inherit.
root@sol11aa ~# zfs inherit -Sr quota rpool/mita/jenna
root@sol11aa ~# zfs get -r quota rpool/mita
NAME PROPERTY VALUE SOURCE
rpool/mita quota none default
rpool/mita/jenna quota none default
rpool/mita/josep quota none default

2010-10-20

funny directory on Solaris

bell21# cd /usr/share/man/
bash: cd: /usr/share/man/: No such file or directory
bell21# cd /usr/share/
bell21# file man
man: directory
bell21# chmod 755 man
chmod: WARNING: can't change man
bell21# cd man
bash: cd: man: No such file or directory
bell21# ls ma*
man: No such file or directory
bell21# echo ma*
man
bell21# ls -l /usr/share | grep man
dr-xr-xr-x 1 root root 1 Oct 20 08:52 man
bell21#
Answer below...

One of my students put
/usr/share/man bell21:/usr/share/man
in the /etc/auto_direct file ;-)

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!

2010-02-04

Debian in a branded zone

Being in bed all day, I've been playing (just for fun, nothing serious) with Linux brandz zones on Solaris 10.

root@sol10u8 export# zoneadm -z debianzone boot
root@sol10u8 export# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
7 debianzone running /export/debianzone lx shared
- zoneldap installed /export/zoneldap native shared
- zonedns installed /export/zonedns native excl
- lx-zone installed /export/lx-zone lx shared
- zonejs configured /export/zonejs native shared
root@sol10u8 export#

Solaris 10 only supports 2.4 kernels.

debianzone:~# uname -a
Linux debianzone 2.4.21 BrandZ fake linux i686 GNU/Linux

The debianzone cannot connect to the internet. Ping to router/dns server works, with some strange (but not unexpected) messages:

debianzone:~# ping 192.168.1.1
WARNING: setsockopt(ICMP_FILTER): Protocol not available
Do you have CONFIG_SOCKET in your kernel?WARNING: your kernel is veeery old. No problems.
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=3.56 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.77 ms

Setting a route is not possible.

debianzone:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
debianzone:~# route add -net 127.0.0.0
SIOCADDRT: Invalid argument
debianzone:~# route add -net 192.168.1.0 dev eth0
SIOCADDRT: Invalid argument
debianzone:~# route add default gateway 192.168.1.1
SIOCADDRT: Invalid argument
debianzone:~#

On Opensolaris it seems to work, but not (yet?) on Solaris 10.

2009-09-22

strange (Open)Solaris PATH behavior

The PATH variable usually does not contain the . directory, which means files in the . directory cannot be executed without ./ afaik
$ cat w.cmd
who
$ PATH=/usr/bin
$ w.cmd
-bash: w.cmd: command not found

But then this happened on Solaris 10:
$ PATH=/usr/bin:
$ w.cmd
paul pts/2 Sep 22 20:20 (192.168.1.34)
$

Note the colon at the end of the PATH variable. I tested this in Solaris 10 and OpenSolaris, both in Korn and bash. Why does it allow execution from within the current directory ?
(This feature/bug does not work in Linux btw)