1

I have a system that creates periodic btrfs snapshots and deletes old ones. Today, I've started receiving warnings that the system can't delete some old snapshots.

This is the output I get:

root@machine:/path# btrfs sub del 2014-10-26--01-50-01-@ten_minutely
Delete subvolume '/path/2014-10-26--01-50-01-@ten_minutely'
ERROR: cannot delete '/path/2014-10-26--01-50-01-@ten_minutely'

I can create and delete new snapshots without a problem - just a couple of them, created today, exhibit this behaviour.

The permissions look ok. Syslog show nothing related. I checked btrfs filesystem df, and there's space available for the filesystem - both for metadata and data.

A strace of the delete command shows:

#...
ioctl(3, 0x5000940f, 0xffa1d1f0)        = -1 ENOTEMPTY (Directory not empty)
close(3)                                = 0
#...

What further steps can I take to investigate the cause?

loopbackbee
  • 1,395
  • 1
  • 10
  • 21
  • I hope that you are not housing production data on a btrfs filesystem its not to that level yet. – mdpc Oct 26 '14 at 20:49
  • @mdpc Sort of - it's a small system with just a couple of users. I've been using btrfs without significant problems for about 3 years now – loopbackbee Oct 27 '14 at 02:00

1 Answers1

4

After some digging around, I found the root of the problem

Inside the snapshots that cannot be deleted, there was a subvolume - apparently another snapshot. The system that creates periodic snapshots must have run twice for the same path - thus creating the second snapshot inside the first, instead of taking that name.

For the record, I'm using btrfs-snapshot-rotation through plain cron. Since I had multiple snapshot frequencies, two must have run in the same second. A potential solution is to switch to anacron.

loopbackbee
  • 1,395
  • 1
  • 10
  • 21