Saturday, October 4, 2014

In specific directory, how to copy-on-write like snapshot.

In the general , it is the method that make hard-link
and can do copy-on-write by two ways.

<1> Make hard-link

$ cp -al one_folder hard_linked_folder

<2> Simply, there are two ways to use copy-on-write.

<2-1> cowdancer

The way demonstrate copy-on-write in only a shell session.

$ sudo apt-get install cowdancer

Invoke cow-shell and it start a shell session that will protect the i-node below the current directory.

$ cd hard_linked_folder
$ cow-shell
 # Invoking /bin/bash (it is output)

And then, if you write any files in ‘hard_linked_folder’, copy-on-write coincide with it.
If you want to finish the situation, by ‘exit’ you can quit it.

$ exit

<2-2> fl-cow

This one can do copy-on-write when a specific program write some in the folder ‘hard_linked_folder’.

$ sudo apt-get install fl-cow

This one is more easy than cowdancer.
Just run a program you want to monitor with ‘cow‘.

$ cow program
$ cow utserver # it is a example.
               # utserver is utorrent server.
               # If utserver modify some in the folder,
               # fl-cow will protect the i-node
               # to preserve original files.

You can check whether the program is run with ‘fl-cow’ or not.

$ lsof | grep cow

If you can’t see anything, run the program with ‘cow’ again.

No comments:

Post a Comment