problem with noatime flag

Bug #833980 reported by Mario
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
apt-btrfs-snapshot (Ubuntu)
Fix Released
High
Unassigned

Bug Description

I'm actually using apt-btrfs-snapshot 0.2 on Ubuntu Natty because I like the cron script to delete old snapshots. I've noted in the code that apt-btrfs-snapshot uses the atime of the file /etc/fstab to determine the age of the snapshot. Such method is not reliable using options like noatime in the root file-system. Such kind of options are strongly suggested for laptop disk HDD or SDD. It is also automatically used by packages like laptop-mode.
Using noatime on root, the weekly cron script remove all my snapshots.

Michael Vogt (mvo)
Changed in apt-btrfs-snapshot (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugreport.

I added some code into trunk now that will detect noatime and simply bail out for now. We need a more clever way of detecting the snapshots age in this case. The code must ensure that it detects when a snapshot was booted last, not when it was taken.

Changed in apt-btrfs-snapshot (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt-btrfs-snapshot - 0.3

---------------
apt-btrfs-snapshot (0.3) quantal; urgency=low

  [ Michael Vogt ]
  * apt_btrfs_snapshot.py, test/test_apt_btrfs_snapshot.py:
    - disable "delete-older-than" command if noatime is in use on
      the snapshot fs (LP: #833980)
  * merge lp:~brian-murray/apt-btrfs-snapshot/fix-vcs/, many thanks!
  * apt_btrfs_snapshot.py:
    - be even more robust against invalid fstab entries
      (LP: #873411 comment #7)
  * test/test_pyflakes.py:
    - add test that ensures that its pyflakes clean

  [ Dmitrijs Ledkovs ]
  * apt_btrfs_snapshot.py, apt-btrfs-snapshot:
    - port to python3
  * apt_btrfs_snapshot.py:
    - fix pyflakes warning use 'AptBtrfsNotSupportedError' instead of
      undefined name 'AptBtrfsSnapshotNotSupportedError'
  * test/test_apt_btrfs_snapshot.py:
    - remove unused imports 'LowLevelCommands' and 'apt_btrfs_snapshot'
    - mock sys.stdout and sys.stderr to avoid confusing and spurious output
    - mock /sbin/btrfs to allow running unit-tests without btrfs-tools
  * debian/rules:
    - build with supported versions of python2 and python3
    - run unittests at build time, honoring nocheck
  * debian/control:
    - adjust dependencies for python3 support
    - bump standards version to 3.9.3
 -- Michael Vogt <email address hidden> Tue, 12 Jun 2012 12:06:31 +0200

Changed in apt-btrfs-snapshot (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Benjamin Schmid (benbuntu) wrote :

I'm coming from question 263994 and I was wondering why apt-btrfs-snapshot denies to work on a fs with noatime.
Initially I had expected mtime should be enough.

> The code must ensure that it detects when a snapshot was booted last, not when it was taken.
Can you elaborate why it is not enough to simply look at the age of the snapshot?

Revision history for this message
Dark Dragon (darkdragon-001) wrote :

Can you please add a comment on why the atime check is necessary?

Revision history for this message
Dmitriy Geels (dmig) wrote :

@benbuntu, @darkdragon-001 see here: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/vivid/apt-btrfs-snapshot/vivid/view/head:/apt_btrfs_snapshot.py#L194

Author uses atime of /etc/fstab inside the snapshot to know it's creation time.
- Simplest fix would be to exclude `noatime` from mount options list, which read from /etc/fstab.
- Another way is to create some empty file in filesystem root, lets say `apt-btrfs-snapshot` and use it's ctime for checking. After snapshot created, that file should be deleted.

Revision history for this message
Dark Dragon (darkdragon-001) wrote :

I think it is better to parse the snapshot name, since it includes the creation time anyway. Feel free to review my changes: https://code.launchpad.net/~darkdragon-001/apt-btrfs-snapshot/trunk

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.