-
-
Save cstrahan/7190874 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # snapshot the previous volume before updating | |
| # otherwise there will be a CoW for each child, which could get slow quickly | |
| btrfs subvolume snapshot /btrfs/base/precise-amd64-2013-04-01 /btrfs/base/precise-amd64-2013-04-31 | |
| # differential copy --inplace avoids the tempfile/mv so large files can remain shared | |
| rsync -avx --inplace --delete server.domain.com::precise-amd64 /btrfs/base/precise-amd64-2013-04-31 | |
| # now make a snapshot for an app | |
| btrfs subvolume snapshot /btrfs/base/precise-amd64-2013-04-31 /btrfs/image/ID | |
| # then pull the app's 'overlay', no --delete since it should just be the diff | |
| rsync -avx --inplace server.domain.com::app-ID /btrfs/image/ID | |
| # now create a container for the app to run in | |
| btrfs subvolume snapshot /btrfs/image/ID /btrfs/app/ID-INSTANCE | |
| # check out your new container | |
| chroot /btrfs/app/ID-INSTANCE /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment