--> existing zones on my system
root@catalogne:~# zoneadm list -iv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
- identity_manager_80 installed /zones/identity_manager_80 ipkg shared
- sparse installed /z/sparse ipkg shared
- identity-manager-80 installed /z/identity-manager-80 ipkg shared
Let's play a little with the zone name identity-manager-80 !
--> booting the zone
root@catalogne:~# zoneadm -z identity-manager-80 boot
To create a snapshot of a zone we need to use zfs snapshot.
Some theory :
root@catalogne:~# zfs
missing command
usage: zfs command args ...
where 'command' is one of the following:
...
snapshot [-r] [-o property=value] ...
...
root@catalogne:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 14.8G 83.1G 74K /rpool
rpool/ROOT 4.10G 83.1G 18K legacy
rpool/ROOT/opensolaris 4.10G 83.1G 3.96G /
rpool/dump 1.62G 83.1G 1.62G -
rpool/export 3.75G 83.1G 19K /export
rpool/export/home 3.75G 83.1G 19K /export/home
rpool/export/home/rudy 3.75G 83.1G 3.75G /export/home/rudy
rpool/identity_manager_80 2.49G 83.1G 21K /zones/identity_manager_80
rpool/identity_manager_80/ROOT 2.49G 83.1G 18K legacy
rpool/identity_manager_80/ROOT/zbe 2.49G 83.1G 2.49G legacy
rpool/share 18K 83.1G 18K /zones/share
rpool/swap 1.62G 84.7G 53.3M -
rpool/z 1.22G 83.1G 1006M /z
rpool/z/identity-manager-80 5.09M 83.1G 21K /z/identity-manager-80
rpool/z/identity-manager-80/ROOT 5.07M 83.1G 18K legacy
rpool/z/identity-manager-80/ROOT/zbe 5.05M 83.1G 240M legacy
rpool/z/sparse 239M 83.1G 21K /z/sparse
rpool/z/sparse/ROOT 239M 83.1G 18K legacy
rpool/z/sparse/ROOT/zbe 239M 83.1G 238M legacy
rpool/zones 18K 83.1G 18K /rpool/zones
Is identity-manager-80 the one to snapshot ? Answer : NO !
Let's proove that it is not /z/identity-manager-80.
--> let's open a console :
root@catalogne:~# zlogin -C identity-manager-80
[Connected to zone 'identity-manager-80' console]
identity-manager-80 console login: root
Password:
Mar 5 09:26:42 identity-manager-80 login: ROOT LOGIN /dev/console
Last login: Wed Mar 4 17:56:46 on console
Sun Microsystems Inc. SunOS 5.11 snv_101b November 2008
--> let's create a big file : big and size of big is 500 mb.
root@identity-manager-80:~# mkfile 500m bigfile
root@identity-manager-80:~# mkfile 500m bigfile_to_disappear
root@identity-manager-80:~# ls -lrt
total 936067
-rw------- 1 root root 524288000 Mar 5 09:28 bigfile
root@catalogne:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 15.2G 82.7G 74K /rpool
rpool/ROOT 4.10G 82.7G 18K legacy
rpool/ROOT/opensolaris 4.10G 82.7G 3.96G /
rpool/dump 1.62G 82.7G 1.62G -
rpool/export 3.75G 82.7G 19K /export
rpool/export/home 3.75G 82.7G 19K /export/home
rpool/export/home/rudy 3.75G 82.7G 3.75G /export/home/rudy
rpool/identity_manager_80 2.49G 82.7G 21K /zones/identity_manager_80
rpool/identity_manager_80/ROOT 2.49G 82.7G 18K legacy
rpool/identity_manager_80/ROOT/zbe 2.49G 82.7G 2.49G legacy
rpool/share 18K 82.7G 18K /zones/share
rpool/swap 1.62G 84.3G 53.3M -
rpool/z 1.63G 82.7G 1006M /z
rpool/z/identity-manager-80 419M 82.7G 21K /z/identity-manager-80
rpool/z/identity-manager-80/ROOT 419M 82.7G 18K legacy
rpool/z/identity-manager-80/ROOT/zbe 419M 82.7G 654M legacy
rpool/z/sparse 239M 82.7G 21K /z/sparse
rpool/z/sparse/ROOT 239M 82.7G 18K legacy
rpool/z/sparse/ROOT/zbe 239M 82.7G 238M legacy
rpool/zones 18K 82.7G 18K /rpool/zones
From 240M to 654M(col REFER)
/ROOT/zbe has to be used and
--> Let's snapshot rpool/z/identity-manager-80/ROOT/zbe !
From the global zone
root@catalogne:~# zfs snapshot rpool/z/identity-manager-80/ROOT/zbe@snap0933
--> List of the snapshots
root@catalogne:~# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
rpool/ROOT/opensolaris@install 138M - 2.21G -
rpool/z/identity-manager-80/ROOT/zbe@snap0933 0 - 740M -
rpool/z/sparse/ROOT/zbe@identity-manager-80_snap 542K - 236M -
We can retrieve in the list that snapshot that interest us : rpool/z/identity-manager-80/ROOT/zbe@snap0933.
Let's go back to the zone and create a second bigfile. The idea is to rollback the zone using the znapshot we have just taken and see what happened !
root@identity-manager-80:~# mkfile 500m bigfile_to_disappear
root@identity-manager-80:~# ls -lrt
total 936067
-rw------- 1 root root 524288000 Mar 5 09:28 bigfile
-rw------- 1 root root 524288000 Mar 5 09:37 bigfile_to_disappear
root@catalogne:~# zfs
missing command
usage: zfs command args ...
where 'command' is one of the following:
...
rollback [-rRf]
...
root@catalogne:~# za -z identity-manager-80 halt
root@identity-manager-80:~#
[NOTICE: Zone halted]
root@catalogne:~# zfs rollback rpool/z/identity-manager-80/ROOT/zbe@snap0933
root@catalogne:~# za -z identity-manager-80 boot
[NOTICE: Zone booting up]
SunOS Release 5.11 Version snv_101b 64-bit
Copyright 1983-2008 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: identity-manager-80
Reading ZFS config: done.
Mounting ZFS filesystems: (5/5)
--> Login as root again.
identity-manager-80 console login: root
Password:
Mar 5 09:42:11 identity-manager-80 login: ROOT LOGIN /dev/console
Last login: Thu Mar 5 09:26:42 on console
Sun Microsystems Inc. SunOS 5.11 snv_101b November 2008
root@identity-manager-80:~# ls
bigfile
Youpee ! Indeed the file bigfile_to_disappear is gone !
That's all for today. I hope it will make your life easier because you can try something and then make it gone !
All you need is ZFS !!!
-Rudy-
No comments:
Post a Comment