Originally posted by oshunluvr
View Post
... unless that HD or partition is TWICE OR 3X as big as the maximum size of your anticipated storage needs
Originally posted by oshunluvr
View Post
Originally posted by oshunluvr
View Post
Originally posted by oshunluvr
View Post
Let's say you've got another computer with a btrfs filesystem and you want to back up your home directory from this computer to the other one. We'll use btrfs' built-in asynchronous replication for this. First, let's create a new subvolume underneath /home to contain the snapshots:
me@virtual-machine:~$ sudo btrfs sub create /home/.snapshots
Create subvolume '/home/.snapshots' Now, let's take our first snapshot:
me@virtual-machine:~$ sudo btrfs sub snapshot -r /home /home/.snapshots/myfirstsnapshot
Create a readonly snapshot of '/home' in '/home/.snapshots/myfirstsnapshot' We can see the new structure with another btrfs subvolume list:
Now, let's replicate the snapshot to our second machine, which has convenient subvolumes named /backup and /backup/home and /backup/home/.snapshots.
In its simplest possible form, this demonstrates sending the snapshot—which contains the entire /home subvolume at the time it was taken, remember—and tunneling it through ssh to the btrfs filesystem on the other end. There's nothing too special about this yet. Sure, you're replicating the entire subvolume all at once, which is kind of neat, but you could accomplish this in all kinds of ways. Where this gets cool is when we take and send a second snapshot:
What we did here was send only the data that has changed on-disk between "myfirstsnapshot" and "mysecondsnapshot." What's especially awesome about this is that the system doesn't have to laboriously scan the disks to find things that have changed. It already knows what has or hasn't changed, so it can just immediately start spitting data out to the receive process on the other end. If you have a few text files to replicate, this might not matter. But if you have a terabyte or five of database binaries or virtual machine storage, this is a huge deal. Backups that would have taken hours or days and generated a tremendous amount of system load with older technologies can now complete in minutes with little or no extra load.
I have systems that routinely replicate a terabyte or more of data across cheap 3Mbps and slower Internet connections using this technology... sometimes, replicating several times per day. There is literally no other technology that can accomplish this. If you have a six-figure SAN that replicates off-site several times a day, incremental snapshot replication is how it does it.
me@virtual-machine:~$ sudo btrfs sub create /home/.snapshots
Create subvolume '/home/.snapshots' Now, let's take our first snapshot:
me@virtual-machine:~$ sudo btrfs sub snapshot -r /home /home/.snapshots/myfirstsnapshot
Create a readonly snapshot of '/home' in '/home/.snapshots/myfirstsnapshot' We can see the new structure with another btrfs subvolume list:
me@virtual-machine:~$ sudo btrfs sub list /
ID 256 gen 199294 top level 5 path @
ID 257 gen 199294 top level 5 path @home
ID 849 gen 199310 top level 5 path @home/.snapshots
ID 850 gen 199311 top level 5 path @home/.snapshots/myfirstsnapshot
ID 256 gen 199294 top level 5 path @
ID 257 gen 199294 top level 5 path @home
ID 849 gen 199310 top level 5 path @home/.snapshots
ID 850 gen 199311 top level 5 path @home/.snapshots/myfirstsnapshot
me@virtual-machine:~$ sudo btrfs send /home/.snapshots/myfirstsnapshot | ssh second-machine sudo btrfs receive /backup/home/.snapshots
me@virtual-machine: sudo btrfs sub snapshot -r /home /home/.snapshots/mysecondsnapshot
me@virtual-machine: sudo btrfs send -p /home/.snapshots/myfirstsnapshot /home/.snapshots/mysecondsnapshot | ssh second-machine btrfs receive /backup/home/.snapshots
me@virtual-machine: sudo btrfs send -p /home/.snapshots/myfirstsnapshot /home/.snapshots/mysecondsnapshot | ssh second-machine btrfs receive /backup/home/.snapshots
I have systems that routinely replicate a terabyte or more of data across cheap 3Mbps and slower Internet connections using this technology... sometimes, replicating several times per day. There is literally no other technology that can accomplish this. If you have a six-figure SAN that replicates off-site several times a day, incremental snapshot replication is how it does it.
Comment