zfs Snapshots / Clones

por | 19 marzo, 2008

bash-3.00# zfs create poolraidz1/home

bash-3.00# zfs list
NAME              USED  AVAIL  REFER  MOUNTPOINT
poolraidz1        121K  9.78G  24.5K  /poolraidz1
poolraidz1/home  24.5K  9.78G  24.5K  /poolraidz1/home

Quota:
bash-3.00# zfs set quota=4G poolraidz1/home

bash-3.00# zfs list
NAME              USED  AVAIL  REFER  MOUNTPOINT
poolraidz1        122K  9.78G  25.5K  /poolraidz1
poolraidz1/home  24.5K  4.00G  24.5K  /poolraidz1/home

############ ZFS Snapshots #################

Features:
1. Read-only copies of volumes or file systems
2. Use no additional space, initially

####Return available snapshot
bash-3.00# zfs list -t snapshot
no datasets available

###Create spanpshot##########
bash-3.00# zfs snapshot poolraidz1/home@homespan1
bash-3.00# echo $?
0

bash-3.00# zfs list -t snapshot
NAME                        USED  AVAIL  REFER  MOUNTPOINT
poolraidz1/home@homespan1      0      –  24.5K  –

hidden directory spanshots
/poolraidz1/home/.zfs/snapshot/homespan1

test snapshots
bash-3.00# cd /poolraidz1/home/
bash-3.00# echo «testint spanshot 3» > test.txt
bash-3.00# zfs snapshot poolraidz1/home@homespan3

#### Destroy Snapshots ###############
bash-3.00# zfs destroy poolraidz1/home@homesnap1

#### Rename Snapshots ###############
bash-3.00# zfs rename poolraidz1/home@homespan2 poolraidz1/home@homespandos
bash-3.00# zfs list -t snapshot
NAME                          USED  AVAIL  REFER  MOUNTPOINT
poolraidz1/home@homespandos  22.5K      –  24.5K  –
poolraidz1/home@homespan3      23K      –    25K  –

####   Roll backs   #########################
bash-3.00#zfs rollback -f poolraidz1/home@homesnap3
bash-3.00#echo $?


####   CLONES ###################
( First create a snapshot and then a clone)

Features:
1. Writable file systems or volumes
2. Linked to a snapshot
3. Clone can be stored anywhere in ZFS hierarchy

bash-3.00# zfs clone poolraidz1/home@homesnap3 poolraidz1/homeclone1   
bash-3.00# echo $?
0

the clone inherited attributes of the target file system
snapshots do not inherited attributes