Skip to contentSkip to conversation

subvol copying

DISCUSSION Russell Coker 4 participants 6 messages May 15, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

A user of a workstation has a home directory /home/john as a subvolume. I wrote a cron job to make read-only snapshots of it under /home/john/backup which was fortunate as they just ran a script that did something like "rm -rf ~".

Apart from copying dozens of gigs of data back, is there a good way of recovering it all? Whatever you suggest isn't going to work for this time (the copy is almost done) but will be useful for next time.

I'm guessing that I can't delete a subvol that has other subvols under it.

Should I have put the backups under /backup instead so that I could just delete the corrupted subvol and make a read-write snapshot of the last good one?

Signature · 2 lines
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/
#1 lore raw
Quoted 5 lines

A user of a workstation has a home directory /home/john as a subvolume. I wrote a cron job to make read-only snapshots of it under /home/john/backup which was fortunate as they just ran a script that did something like "rm -rf ~".

Quoted 7 lines

Apart from copying dozens of gigs of data back, is there a good way of recovering it all? Whatever you suggest isn't going to work for this time (the copy is almost done) but will be useful for next time.

Should I have put the backups under /backup instead so that I could just delete the corrupted subvol and make a read-write snapshot of the last good one?

You can move subvolumes at any time, as if they were regular directories.

For example: move the backups to an external location, move what's left of the home to another location out of the way, and make a snapshot to restore.

#2 lore raw
Quoted 2 lines · Gabriel de Perthuis

You can move subvolumes at any time, as if they were regular directories.

In the example case, the subvolumes are read-only. So is it possible to make a read-only subvolume (snapshot) read-writable? And is it possible to make a read-writeable snapshot of a read-only subvolume?

Chris Murphy

#3 lore raw
Quoted 9 lines · Chris Murphy
Quoted 2 lines · Gabriel de Perthuis

You can move subvolumes at any time, as if they were regular directories.

In the example case, the subvolumes are read-only. So is it possible to make a read-only subvolume (snapshot) read-writable? And is it possible to make a read-writeable snapshot of a read-only subvolume?

Quoted 6 lines

Chris Murphy

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

You make a ro snapshot rw by creating a snapshot of it that is rw. So yes to both questions, by doing the same thing in both cases.

#4 lore raw
Quoted 3 lines · Harald Glatt

You make a ro snapshot rw by creating a snapshot of it that is rw. So yes to both questions, by doing the same thing in both cases.

In other words, a normal snapshot (without -r) of a read-only snapshot will create a rw snapshot?

In any case, for the OP, making a rw snapshot of the last backup ro snapshot, and putting it in place of the home folder is the way to do the rollback.

Chris Murphy

#5 lore raw
Quoted 8 lines · Chris Murphy
Quoted 3 lines · Harald Glatt

You make a ro snapshot rw by creating a snapshot of it that is rw. So yes to both questions, by doing the same thing in both cases.

In other words, a normal snapshot (without -r) of a read-only snapshot will create a rw snapshot?

Yes