0

I am mounting an old btrfs volume in a newer Linux. The mount point is /mnt/linux2. However, btrfs's internal snapshots are shown as directories on the mounted disk, e.g.

/mnt/linux2/.snapshots/189/snapshot/usr/share/mythes/th_en_US_v2.dat

instead of just

/mnt/linux2/usr/share/mythes/th_en_US_v2.dat

How can I mount the volume and (probably through specifying mount options) show the btrfs partition as a flat, non-snapshotted filesystem, i.e. hide the snapshots and show only current versions of files?

Here is the line from /etc/fstab:

UUID=01234567-89ab-cdef-0123-456789abcdef /mnt/linux2 btrfs rw,relatime,ssd,space_cache,subvolid=5,subvol=/ 0 0
  • 1
    use subvol=.snapshots/189/snapshot instead of subvolid=5,subvol=/? – Tom Yan Aug 29 '17 at 11:23
  • Actually, there are directories .snapshots/$N/snapshot for very many $Ns. I wish to hide all snapshots, not pick a single one (I would not know which one, anyway, just want the newest). – Ned64 Aug 29 '17 at 12:30
  • So you are not trying to mount a specifc subvol/snapshot but the top-level one? – Tom Yan Aug 29 '17 at 12:39
  • Yes, the "current" version, flattened. – Ned64 Aug 29 '17 at 12:40
  • I don't suppose there is a way to hide it? Because I think the .snapshot directory is not that internal but created by yourself? – Tom Yan Aug 29 '17 at 12:45
2

Tom Yan is correct, .snapshots is not a BTRFS internal directory, it's created and managed on OpenSUSE (and possibly Ubuntu) by a piece of software called snapper. Anything under that directory is a historical version, and the versions present in @ are the current ones (and that is what is mounted by default as / during normal system operations).

The issue here is arguably not BTRFS, but the managers in charge of this aspect of OpenSUSE not thinking about the impacts on off-line maintenance of a system and instead focusing on making things as easy as possible for their developers to implement.

For future reference, you can avoid this crap by disabling snapshotting for the root filesystem during the OpenSUSE install.

  • Thanks. It is good to know who is to blame (snapper, apparently). Is that a solution, though? I cannot change the past! Can I mount it while hiding it? I suppose as a workaround I could mount an empty tmpfs over /mnt/linux2/.snapshots but I would call that a workaround, not a solution, really. – Ned64 Aug 29 '17 at 16:09
  • There's not really a good solution to be honest. It's non-trivial to convert the system away from the 'snapshot friendly' layout once it's installed. The best option I can think of is to get a list of installed packages, copy out the config and user data, and reinstall it from scratch. – Austin Hemmelgarn Aug 29 '17 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.