Help Deleting Read-Only BTRFS Snapshot


Dr. Ew

Recommended Posts

Hi guys,

 

I have two read-only snapshots which I need to delete. Also, somehow an old TimeMachine share founds its way to /mnt/TimeMachine. I need to delete all three items. 

 

As far as I know, the only way to delete a read only item is to make it writable, and then delete it. The only way I know how to do such is by executing the following command: btrfs property set -ts /path/to/snapshot ro false

 

However, I have executed the command as Root, and when I execute the command to delete the snapshot, the following is returned: rm: cannot remove '/path/to/snapshot' : read-only file system. 

 

What other methods may I utilize to delete these two snapshots? My assumption is I should be able to utilize the same command to  delete /mnt/TimeMachine.

 

Help is much appreciated. Thank you.

Link to comment
50 minutes ago, Dr. Ew said:

/mnt/TimeMachine

Don't think that's the correct path, as thats in RAM, and a simple reboot would remove it.

 

Assuming that the path is /mnt/user/... and you're getting read-only file system, are you sure the file system on the disk(s) aren't mounted read-only?  I don't use BTRFS, but doesn't a simple chmod work?

Link to comment
3 hours ago, Squid said:

Don't think that's the correct path, as thats in RAM, and a simple reboot would remove it.

 

Assuming that the path is /mnt/user/... and you're getting read-only file system, are you sure the file system on the disk(s) aren't mounted read-only?  I don't use BTRFS, but doesn't a simple chmod work?

Thank you. That was my mistake on stating /mnt/TimeMachine. It was /mnt/user/TimeMachine. I couldn't delete it in place, but I was able to move the folder to /mnt/disks/cache, and delete it there. 

 

As far as the BTRFS snapshots go, I created the snapshot as readonly (as root). chmod doesn't work for the readonly snapshot, unfortunately. 

Link to comment
3 hours ago, Dr. Ew said:

Thank you. That was my mistake on stating /mnt/TimeMachine. It was /mnt/user/TimeMachine. I couldn't delete it in place, but I was able to move the folder to /mnt/disks/cache, and delete it there. 

 

As far as the BTRFS snapshots go, I created the snapshot as readonly (as root). chmod doesn't work for the readonly snapshot, unfortunately. 

 

are you using the cmd: btrfs subvol delete  /mnt/user/TimeMachine/xxx ?

Link to comment
On 12/31/2019 at 11:57 PM, trott said:

 

are you using the cmd: btrfs subvol delete  /mnt/user/TimeMachine/xxx ?

Thank you. That worked for TimeMachine. I've still got the read. only snapshots I can't delete, though. I tried that with the Btrfs sub delete command, and still am unable.

Link to comment
17 hours ago, johnnie.black said:

That's the correct command to delete btrfs snapshots, post a list of current snapshots:

 


btrfs sub list /path

There are very many of them. But here is an excerpt which includes the three I am trying to get rid of (highlighted)

 

root@nAR1:~# btrfs sub list /mnt/cache
ID 395 gen 243944 top level 5 path loops.samples
ID 397 gen 234007 top level 5 path mixes
ID 399 gen 167630 top level 5 path domains
ID 400 gen 232037 top level 5 path media
ID 402 gen 243868 top level 5 path gDrive
ID 645 gen 167635 top level 397 path gDrive/Snaps/gDrive.11.28.2019
ID 646 gen 167640 top level 395 path loops.samples/snaps/loops.samples.12.21.2019
ID 647 gen 167684 top level 400 path media/snaps/media.12.28.2019
ID 775 gen 232626 top level 5 path media

root@nAR1:~# btrfs sub list /mnt/disk1
ID 3100 gen 6598 top level 5 path Backup
ID 5384 gen 6429 top level 3100 path backup/snaps/rosnap2del
ID 5386 gen 6599 top level 5 path archive
ID 5387 gen 6442 top level 5386 path archive/pre.2020.archive/snaps/nARarchive.12.28.2019

root@nAR1:~# btrfs sub list /mnt/disk2
ID 3470 gen 3720 top level 5 path rosnap1
ID 3471 gen 3239 top level 3470 path rosnap1/snaps/rosnap1del

ID 3472 gen 3796 top level 5 path archive
ID 3473 gen 3245 top level 3472 path archive/pre.2020.archive/snaps/rosnap3del
ID 3474 gen 3806 top level 5 path Backup

 

I was able to delete rosnap1del and rosnap3del. I had to make the entire path writable (/mnt/disk1/backup/snaps/rosnap2del).

 

However, on the rosnap2, i try to make it writable, just like the others (/mnt/disk1/backup/snaps/rosnap2del), and it tells me it is not a BTRFS file system. Very strange. 

Edited by Dr. Ew
Link to comment

Ah, I got the last one.  I had to go deeper down to make a snapshot writable. It was a snapshot of a directory that included a snapshot of a directory of a snapshot of a directory, haha. Once I made the offending directory writable, I was able to delete.

 

i also forgot that the Subvolume location is /mnt/disk2/rosnapdel2 and not at /mnt/user/rosnapdel2.

 

thanks for the help, tips, and guidance

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.