Restore single files from a btrfs snapshot without doing a full copy
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Background
I maintain a series of hourly snapshots on my btrfs filesystem using btrbk. The subvolume and snapshots are stored like this (names shortened to make it easier to follow):
/@vol (subvolume)
/btrbk/@vol.00 (snapshots of /@vol, one per hour)
/btrbk/@vol.01 ...
/home/user/vol (mountpoint for /@vol)
Now I deleted a single file in /home/user/vol
which I should not have deleted. No problem, I can easily restore from the latest snapshot:
# cd /home/user/vol
# cp -a --reflink=always /btrbk/@vol.01/all_ipv4_numbers.txt ./
cp: failed to clone './all_ipv4_numbers.txt' from '/btrbk/@vol.01/all_ipv4_numbers.txt': Invalid cross-device link
Seems I can't "reflink" the file. But I don't want to end up with two copies of the file. Ideally I want it to look like nothing happened between the most recent snapshot and the next snapshot that will be taken in the future.
(Yes, I also have actual backups, but restoring from snapshots are more convenient whenever available!)
Question
How do I restore a single file from a btrfs snapshot while keeping all the nice references and magic that makes btrfs know that it is the same data in all the snapshots?
btrfs snapshot
add a comment |Â
up vote
0
down vote
favorite
Background
I maintain a series of hourly snapshots on my btrfs filesystem using btrbk. The subvolume and snapshots are stored like this (names shortened to make it easier to follow):
/@vol (subvolume)
/btrbk/@vol.00 (snapshots of /@vol, one per hour)
/btrbk/@vol.01 ...
/home/user/vol (mountpoint for /@vol)
Now I deleted a single file in /home/user/vol
which I should not have deleted. No problem, I can easily restore from the latest snapshot:
# cd /home/user/vol
# cp -a --reflink=always /btrbk/@vol.01/all_ipv4_numbers.txt ./
cp: failed to clone './all_ipv4_numbers.txt' from '/btrbk/@vol.01/all_ipv4_numbers.txt': Invalid cross-device link
Seems I can't "reflink" the file. But I don't want to end up with two copies of the file. Ideally I want it to look like nothing happened between the most recent snapshot and the next snapshot that will be taken in the future.
(Yes, I also have actual backups, but restoring from snapshots are more convenient whenever available!)
Question
How do I restore a single file from a btrfs snapshot while keeping all the nice references and magic that makes btrfs know that it is the same data in all the snapshots?
btrfs snapshot
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Background
I maintain a series of hourly snapshots on my btrfs filesystem using btrbk. The subvolume and snapshots are stored like this (names shortened to make it easier to follow):
/@vol (subvolume)
/btrbk/@vol.00 (snapshots of /@vol, one per hour)
/btrbk/@vol.01 ...
/home/user/vol (mountpoint for /@vol)
Now I deleted a single file in /home/user/vol
which I should not have deleted. No problem, I can easily restore from the latest snapshot:
# cd /home/user/vol
# cp -a --reflink=always /btrbk/@vol.01/all_ipv4_numbers.txt ./
cp: failed to clone './all_ipv4_numbers.txt' from '/btrbk/@vol.01/all_ipv4_numbers.txt': Invalid cross-device link
Seems I can't "reflink" the file. But I don't want to end up with two copies of the file. Ideally I want it to look like nothing happened between the most recent snapshot and the next snapshot that will be taken in the future.
(Yes, I also have actual backups, but restoring from snapshots are more convenient whenever available!)
Question
How do I restore a single file from a btrfs snapshot while keeping all the nice references and magic that makes btrfs know that it is the same data in all the snapshots?
btrfs snapshot
Background
I maintain a series of hourly snapshots on my btrfs filesystem using btrbk. The subvolume and snapshots are stored like this (names shortened to make it easier to follow):
/@vol (subvolume)
/btrbk/@vol.00 (snapshots of /@vol, one per hour)
/btrbk/@vol.01 ...
/home/user/vol (mountpoint for /@vol)
Now I deleted a single file in /home/user/vol
which I should not have deleted. No problem, I can easily restore from the latest snapshot:
# cd /home/user/vol
# cp -a --reflink=always /btrbk/@vol.01/all_ipv4_numbers.txt ./
cp: failed to clone './all_ipv4_numbers.txt' from '/btrbk/@vol.01/all_ipv4_numbers.txt': Invalid cross-device link
Seems I can't "reflink" the file. But I don't want to end up with two copies of the file. Ideally I want it to look like nothing happened between the most recent snapshot and the next snapshot that will be taken in the future.
(Yes, I also have actual backups, but restoring from snapshots are more convenient whenever available!)
Question
How do I restore a single file from a btrfs snapshot while keeping all the nice references and magic that makes btrfs know that it is the same data in all the snapshots?
btrfs snapshot
btrfs snapshot
asked 5 mins ago
pipe
303114
303114
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f476925%2frestore-single-files-from-a-btrfs-snapshot-without-doing-a-full-copy%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password