c96a3cb3bb2280d1430c6e66097c87bc61854209
[ikiwiki.git] / docs / how_to_implement_hammer_pseudo_file_system__40___pfs___41___slave_mirroring_from_pfs_master / index.mdwn
1 *** THIS GUIDE IS INCOMPLETE ***
2
3 [[!toc]]
4 #Scenario
5 I have two 500 GB hard disks both having hammer file system. I want to create a master pfs in one of the hard disk and a slave pfs in the other disk. I want to mirror the data continuosly from the master pfs to the slave pfs. This will help me avoid long 'fsck'and raid parity rewrite times after an unclean shut down and also will give me a set up some what like Raid.
6
7 #Creating the master pfs on Disk 1
8
9 The hammer file systems on Disk 1 and Disk2 are mounted in '/etc/fstab' according to the following.
10
11     /dev/ad4s1h             /Backup1        hammer  rw              2       2
12     /dev/ad6s1h             /Backup2        hammer  rw              2       2
13
14 Go to the hammer file system on Disk 1. We will be creaing a master pfs called 'test' and will be mounting it using a null mount.
15
16     # pwd
17     /Backup1
18     # mkdir pfs
19      
20     # hammer pfs-master /Backup1/pfs/test
21     Creating PFS #3 succeeded!
22     /Backup1/pfs/test
23     sync-beg-tid=0x0000000000000001
24     sync-end-tid=0x000000013f63be90
25     shared-uuid=b793b798-b3d2-11de-9bef-011617202aa6
26     unique-uuid=b793b7db-b3d2-11de-9bef-011617202aa6
27     label=""
28     prune-min=00:00:00
29     operating as a MASTER
30     snapshots dir for master defaults to <fs>/snapshots
31     # ls pfs
32     test
33
34 Now the master pfs 'test' is created. make a note of its 'shared-uuid' because we will need to use that to create the Slave pfs for mirroring.
35 You can mount the pfs under the hammer file system on Disk 1 by doing the following.
36
37     # mkdir /Backup1/test
38
39 Now Edit '/etc/fstab' to contain the following line.
40
41     /Backup1/pfs/test      /Backup1/test    null    rw              0       0
42
43 Now mount the pfs by doing.
44
45     # mount -a
46     # mount |grep test
47     /Backup1/pfs/@@-1:00003 on /Backup1/test (null, local)
48
49 #Creating the slave pfs on Disk 2. 
50 Note that we will be using the 'shared-uuid of the master pfs so enable mirroring.
51     
52     # mkdir /Backup2/pfs        
53     # hammer pfs-slave /Backup2/pfs/test shared-uuid=b793b798-b3d2-11de-9bef-011617202aa6
54     Creating PFS #3 succeeded!
55     /Backup2/pfs/test
56     sync-beg-tid=0x0000000000000001
57     sync-end-tid=0x0000000000000001
58     shared-uuid=b793b798-b3d2-11de-9bef-011617202aa6
59     unique-uuid=2d3e3c9e-b3d7-11de-9bef-011617202aa6
60     slave
61     label=""
62     prune-min=00:00:00
63     operating as a SLAVE
64     snapshots directory not set for slave
65
66 The slave pfs is not mounted but a symlink is created in the root hammer file system to point to it.
67
68     # ln -s /Backup2/pfs/test /Backup2/test
69     # ls -l /Backup2/test
70     lrwxr-xr-x  1 root  wheel  17 Oct  8 12:07 /Backup2/test -> /Backup2/pfs/test
71
72 #Copying contents from pfs on Disk 1 to pfs on Disk2 to enable mirroring. 
73 The pfs will be accessible only after the first 'mirror-copy' operation.
74
75     # touch /Backup1/test/test-file
76     
77