compute/zfs.md
... ...
@@ -2,20 +2,30 @@
2 2
<!-- SUBTITLE: The Z doesn't mean zettabyte -->
3 3
4 4
## Replace a zpool with minimal downtime
5
+### Create new pool
5 6
```
6 7
zpool create newpool raidz3 sdX sdY sdZ ....
8
+```
9
+### Send the data
10
+```
7 11
zfs snapshot livepool@1
8 12
zfs send -R livepool@1 | zfs receive -F newpool
9
-<wait for send to complete>
13
+```
14
+### Re-sync data that's changed since the initial snapshot
15
+```
10 16
zfs snapshot livepool@2
11 17
zfs send -IR livepool@1 livepool@2 | zfs receive -F newpool
12
-<read-only the live pool>
13
-zfs snapshot livepool@3
14
-zfs send -IR livepool@2 livepool@3 | zfs receive -F newpool
18
+```
19
+Repeat this step if it took too long - increment the @X snapshot number each time
20
+### Flip the pools
21
+Shut down the apps. Check `lsof` and/or `fuser` to make sure nothing's using the FS.
22
+```
23
+zfs snapshot livepool@X
24
+zfs send -IR livepool@X-1 livepool@X | zfs receive -F newpool
15 25
zpool export livepool
16 26
zpool import livepool livepool.old
17 27
zpool export livepool.old
18 28
zpool export newpool
19 29
zpool import newpool livepool
20
-<good to go>
21
-```
... ...
\ No newline at end of file
0
+```
1
+Should be good to go to restart the apps. Destroy any snapshots when you're ready.
... ...
\ No newline at end of file