Reski's hobbies blog place…

This is not just about me, but also bout my family

Archive for the ‘Operating System’ Category

February 21st, 2012 by ayah

How to Delete ZFS Snapshot

To Delete ZFS Snapshot

zfs destroy $snapshot

To make it easy, following is the bash script to delete all the zfs snapshot with single shot

#!/bin/bash
for snapshot in `zfs list -H -t snapshot | cut -f 1`;
do
zfs destroy $snapshot;
done

February 12th, 2012 by ayah

ZFS Send & Receive

ZFS have abilities to save snapshot as file object or save snapshot to other remote.
As I will focus on save snapshot to other remote, only two simple commands that involve here which are zfs send, zfs receive.

The basic concept is send snapshot that you want to send to other remote by ssh protocol and make the remote understand that you gonna give the snapshot

so the commands will be

zfs send [name of the snapshot] | ssh [username]@[remote (ip or hostname)] zfs receive [name of zfs volume]

for example

zfs send DV/Sn03 | ssh reski@zfsserver zfs receive DV/Sn03

If you receive error such as zfs command not found, the solution is that you write full path of zfs in the remote size.

zfs send DV/Sn03 | ssh reski@zfsserver /usr/sbin/zfs receive DV/Sn03

if you receive error such as cannot receive new filesystem stream: permission denied, the solution is that you have to assigned some kind of some ACL permissions to that ZFS volume (remote side). Basic permissions for this remote replication are mount, create and receive

zfs allow everyone mount,create,receive DV/Sn03

* as prerequisite : you should define DV/Sn03 first before you do zfs allow

Additional notes, to send incremental updates, just modify above command

zfs send - [name of the first snapshot] [name of the second snapshot] | ssh [username]@[remote (ip or hostname)] zfs receive [name of zfs volume]

for example

zfs send -i DV/Sn03@1 DV/Sn03@2 | ssh reski@zfsserver zfs receive DV/Sn03

additional note:
if you find message like this

cannot receive new filesystem stream: destination 'VD03/dataVM' exists
must specify -F to overwrite it

it means you have to do it like this

zfs send -i DV/Sn03@1 DV/Sn03@2 | ssh reski@zfsserver zfs receive -F DV/Sn03

Reference :

      http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch06s03.html
      http://www.markround.com/archives/38-ZFS-Replication.html
      http://docs.oracle.com/cd/E19082-01/817-2271/gfwqj/index.html
February 12th, 2012 by ayah

Initialize Your First Git Repository

After you installing your own git server (http://hobby.keluargareski.net/2012/02/11/how-to-install-git-on-centos-5-6/), dont forget to create your first step for GIT repository

On Remote Sides

mkdir my_project.git
cd my_project.git
git --bare init

On Client Sides

mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin youruser@yourserver.com:/path/to/my_project.git
git push origin master

And Congratulations, now you have your own git server

February 11th, 2012 by ayah

How to install Git on Centos 5.6

Git is one of the most powerful versioning software these days. But by default, it wont be listed as previos Centos 6.0 default packages. You have to install it yourselves.
Following are the steps that is required to install it

# Add the repository
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

# Install the latest version of git
yum install --enablerepo=webtatic git-all

Reference:http://stackoverflow.com/questions/3779274/how-can-git-be-installed-on-centos-5-5

February 11th, 2012 by ayah

OpenIndiana & Time-Slider

By default, if you install OpenIndiana Operating System with server installation either USB or CD mode installation, you will never get time-slider features. So what's the beauty of time-slider.

Time Slider is one of ZFS feature that introduce for OpenSolaris Operating system which utilized the ZFS ability to do multiple snapshot. With time-slider, you can forward or backward, your file condition as easy as count 1-2-3

So, how to check whether you have it or not?

You can check it by

reski@nas2:~# svcs -a |egrep "auto-snap|slider"
disabled 4:44:46 svc:/application/time-slider:default
disabled 4:44:46 svc:/application/time-slider/plugin:rsync
disabled 4:44:46 svc:/application/time-slider/plugin:zfs-send
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:monthly
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:daily
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:weekly
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:hourly
disabled 4:44:46 svc:/system/filesystem/zfs/auto-snapshot:frequent

if you got, any messages above, it means you have it. You can use it straight away.

But if you don't, install it by using following commands

 pkg set-publisher -p http://pkg.openindiana.org/sfe

pkg install time-slider

After you install it again, please make sure you check it again by do above command.
To active it via non gui a.k.a console, please check Jason Matthews blogs (http://broken.net/openindiana/how-to-configure-time-slider-without-using-the-gui)

Reference
- http://blog.allanglesit.com/2011/04/zfs-snapshot-management/
- http://borrellstudios.com/2011/07/enabling-time-slider-on-solaris-11-express/