1

I am looking to implement NILFS at my SME but I need a bit of help. I must backup the current system and all snapshots/checkpoints in a different continent to keep auditors happy. I'm currently using a home brewed system (Subversion based) and I can simply rsync that to another computer on another continent. However - how can I remotely backup a NILFS filesystem? Is there a NILFS utility for it or is there a linux block copy version of rsync I can use?

Thanks, in advance, for your help.

Cheers,

Neil

Neil Benn
  • 113

2 Answers2

1

There isn't any utility to copy snapshots across continents, and rsync definitely won't work. I see two possible options here:

  • use DRBD. Create a DRBD cluster between your two sites. Protocol A allows you to keep a good enough performance across large WAN and limited bandwidth. The source NILFS filesystem will be entirely replicated over the destination, with checkpoints and snapshots and everything.

  • use ZFS snapshot replication. This is different from NILFS, but you can get as fast as taking a snapshot every 15 or 30s if needed. However you won't have (as NILFS provides) a complete checkpoint for each and every file created and modified.

[edit] As apparently you need complete and continuous replication, DRBD+NILFS2 seems the best solution. The one limitation that you'll have is, as you're doing block level synchronisation, of course you can only use the filesystem at one end at the time (basically on the "master" side).

When (and if) you need to access the filesystem both on the "master" and the "remote" side, you should do something like this:

On the master, run:

sync

Immediately after, on the slave, run:

drbd disconnect all
# check that you're offline...
drbd primary all

You can then mount the volume on the slave side (while it's still in use on the master side). The replication, of course, is suspended while you're accessing the volume on both sides.

When you're done, simply reconnect the ordinary way: on the slave run

drbd secondary all
drbd --discard-my-data connect all

on the master run

drbd connect all

And after a short while you should be back in sync.

wazoox
  • 7,156
0

Simply make/treat the entire filesystem as a file?

$ truncate -s 1024G FakeBlockDevice.myNILFS2Thing
$ mkfs.nilfs2 FakeBlockDevice.myNILFS2Thing
$ mount FakeBlockDevice.myNILFS2Thing /NILFS2MountPoint

Then you can simply rsync the fake block device like any other file. In fact, I suppose its constant offsets for existing data should be almost perfect for rsync's delta compression:

$ rsync -a FakeBlockDevice.myNILFS2Thing remoteuser@example.com:~/NILFS2Backup.iso

Make the encompassing/"real" filesystem ext4 if you want speed— NILFS2 is reportedly quite slow already, so you shouldn't be losing too much with the added layer of abstraction. Or make it btrfs if you want compression— The extra layer of COW should be fine since NILFS2 only ever writes new data anyway, and my initial testing indicates that BTRFS compression around NILFS2 can save quite a bit, even on lots of small writes of basically random data.


Or actually, why can't you just use rsync?

Is there anything similar to rsync to syncing block devices?

Will Chen
  • 101