btrfs - space_cache v1 or v2 ?
There seems to be conflicting documentation regarding btrfs space_cache v1 and v2 as to which is really the default. man 5 btrfs says: **space_cache, space_cache=<version>, nospace_cache (nospace_cachesince: 3.2, space_cache=v1and space_cache=v2since 4.5, *default: **space_cache=v1**) * There are two implementations of the free space cache. The original one, referred to as v1, is the safe default. The v1space cache can be disabled at mount time with nospace_cachewithout clearing. * If a version is not explicitly specified, the default implementation will be chosen, which is **v1**. ** * https://btrfs.readthedocs.io/en/latest/Administration.html says: (/nospace_cache/since: 3.2,/space_cache=v1/and/space_cache=v2/since 4.5, *default:****/space_cache=v2/**)* There are two implementations of the free space cache. *The original one, referred to as****/v1/**, used to be a safe default but has been superseded by****/v2/**.* The/v1/space cache can be disabled at mount time with/nospace_cache/without clearing. * If a version is not explicitly specified, the default implementation will be chosen, which is****/v2/**.* Does anyone know which documentation is correct ? I would have expected the man pages to be correct, however, it would appear to me they are outdated and the btrfs.readthedocs .io is probably more current. My TW installation is from before v2 existed, did all the zypper dups I've done since TW installation update my btrfs root to v2 or is this something we need to manually do? If it needs to be done, it looks like it is fairly easy to do for a non-root fs, via clearing and remounting, but is there any docs for the root fs ? Has anybody with older TW installs switched or did you just stay with v1 ? It seems like it matters most for large many TB fs and may not matter for smaller fs ( like say 500 GB ). -- Regards, Joe
W dniu 15.06.2023 o 20:14, Joe Salmeri pisze:
There seems to be conflicting documentation regarding btrfs space_cache v1 and v2 as to which is really the default.
man 5 btrfs says:
**space_cache, space_cache=<version>, nospace_cache (nospace_cachesince: 3.2, space_cache=v1and space_cache=v2since 4.5, *default: **space_cache=v1**) *
There are two implementations of the free space cache. The original one, referred to as v1, is the safe default. The v1space cache can be disabled at mount time with nospace_cachewithout clearing.
* If a version is not explicitly specified, the default implementation will be chosen, which is **v1**. ** * https://btrfs.readthedocs.io/en/latest/Administration.html says:
(/nospace_cache/since: 3.2,/space_cache=v1/and/space_cache=v2/since 4.5, *default:****/space_cache=v2/**)*
There are two implementations of the free space cache. *The original one, referred to as****/v1/**, used to be a safe default but has been superseded by****/v2/**.* The/v1/space cache can be
disabled at mount time with/nospace_cache/without clearing.
* If a version is not explicitly specified, the default implementation will be chosen, which is****/v2/**.*
Does anyone know which documentation is correct ? I would have expected the man pages to be correct, however, it would appear to me they are outdated and the btrfs.readthedocs .io is probably more current.
My TW installation is from before v2 existed, did all the zypper dups I've done since TW installation update my btrfs root to v2 or is this something we need to manually do?
If it needs to be done, it looks like it is fairly easy to do for a non-root fs, via clearing and remounting, but is there any docs for the root fs ?
Has anybody with older TW installs switched or did you just stay with v1 ?
It seems like it matters most for large many TB fs and may not matter for smaller fs ( like say 500 GB ).
-- Regards,
Joe
1) My "man 5 btrfs" says the default is v2. I'm on Tumbleweed. 2) The change in documentation was 2 months ago: https://github.com/kdave/btrfs-progs/commit/79bb885c08a5ac23d4ee5597b3e1c9ac...
On 6/15/23 14:43, Adam Mizerski wrote:
W dniu 15.06.2023 o 20:14, Joe Salmeri pisze:
There seems to be conflicting documentation regarding btrfs space_cache v1 and v2 as to which is really the default.
man 5 btrfs says:
**space_cache, space_cache=<version>, nospace_cache (nospace_cachesince: 3.2, space_cache=v1and space_cache=v2since 4.5, *default: **space_cache=v1**) *
There are two implementations of the free space cache. The original one, referred to as v1, is the safe default. The v1space cache can be disabled at mount time with nospace_cachewithout clearing.
* If a version is not explicitly specified, the default implementation will be chosen, which is **v1**. ** * https://btrfs.readthedocs.io/en/latest/Administration.html says:
(/nospace_cache/since: 3.2,/space_cache=v1/and/space_cache=v2/since 4.5, *default:****/space_cache=v2/**)*
There are two implementations of the free space cache. *The original one, referred to as****/v1/**, used to be a safe default but has been superseded by****/v2/**.* The/v1/space cache can be
disabled at mount time with/nospace_cache/without clearing.
* If a version is not explicitly specified, the default implementation will be chosen, which is****/v2/**.*
Does anyone know which documentation is correct ? I would have expected the man pages to be correct, however, it would appear to me they are outdated and the btrfs.readthedocs .io is probably more current.
My TW installation is from before v2 existed, did all the zypper dups I've done since TW installation update my btrfs root to v2 or is this something we need to manually do?
If it needs to be done, it looks like it is fairly easy to do for a non-root fs, via clearing and remounting, but is there any docs for the root fs ?
Has anybody with older TW installs switched or did you just stay with v1 ?
It seems like it matters most for large many TB fs and may not matter for smaller fs ( like say 500 GB ).
-- Regards,
Joe
1) My "man 5 btrfs" says the default is v2. I'm on Tumbleweed. 2) The change in documentation was 2 months ago: https://github.com/kdave/btrfs-progs/commit/79bb885c08a5ac23d4ee5597b3e1c9ac...
I'm on TW 20230514 because I had some projects going on and didn't have time to update but that update is still 1 month AFTER the documentation update timeframe you mentioned. One would expect that with how quickly TW updates it would have been there by the time I updated to 20230514. I always do zypper dup, so wonder why "man 5 btrfs" still says the default is v1 for me? I will be updating soon as the project I was working on wound down, but the bigger questions were whether TW would the root fs migration to space_cache v2 or if we will have to manually do it. Did you check to see which version of space_cache you are using ? That default is for a new fs so unless TW dup includes an migration for the root fs nobody will be updated unless they do it themselves. I am curious as to if others are using it as I'd prefer not to be the first one :-) -- Regards, Joe
On 6/16/23 09:58, K Scott wrote:
On Fri, Jun 16, 2023, at 5:01 AM, Joe Salmeri wrote:
I am curious as to if others are using it as I'd prefer not to be the first one :-)
I've been using space_cache=v2 for at least a year (and probably much longer than that,) without any issues.
Did you also migrate your "/" rootfs ? If so what steps did you follow to do that ? -- Regards, Joe
On Sun, Jun 18, 2023, at 4:09 AM, Joe Salmeri wrote:
Did you also migrate your "/" rootfs ?
If so what steps did you follow to do that ?
My / is also space_cache=v2. As far as I know, it's a device-wide setting, so you can't set it on a per-subvolume basis. I didn't really "migrate" I just backed up my data, reformatted the drive, and then put everything back. -- Kris
Hi Kris, On 6/18/23 08:29, K Scott wrote:
My / is also space_cache=v2. As far as I know, it's a device-wide setting, so you can't set it on a per-subvolume basis.
I didn't really "migrate" I just backed up my data, reformatted the drive, and then put everything back.
Thanks! I agree that you can't set it per-subvolume but from my reading different btrfs filesystems can be using different settings. As I test I created a new btrfs file system using a loop back device and that was setup using space-cache=v2 while my root fs is still using v1. I wondering a TW update will do the root fs conversion at some point or if there is a reason they are holding back ? Converting the non-root fs looks pretty easy but it seems the root one must be done at boot time or by booting off a live DVD and depending on the size it could take a while. What are you using to backup your rootfs and all the subvolumes that the installation creates and then putting it all back? -- Regards, Joe
On Mon, Jun 19, 2023, at 1:37 AM, Joe Salmeri wrote:
I wondering a TW update will do the root fs conversion at some point or if there is a reason they are holding back?
The only way to convert the FS is to do it offline, and there wouldn't be any plans to "upgrade" existing installs. I don't know any other distro that would do this either except for extreme circumstances. Messing with the filesystem metadata of live systems is just asking for trouble. Starting with bftrfs-progs 5.15 space_cache=v2 is the default, so even if it's not been set explicitly, new installs should be using it as far as I'm aware.
What are you using to backup your rootfs and all the subvolumes that the installation creates and then putting it all back?
Nothing special, just tar.
On 6/18/23 21:53, K Scott wrote:
On Mon, Jun 19, 2023, at 1:37 AM, Joe Salmeri wrote:
I wondering a TW update will do the root fs conversion at some point or if there is a reason they are holding back?
The only way to convert the FS is to do it offline, and there wouldn't be any plans to "upgrade" existing installs. I don't know any other distro that would do this either except for extreme circumstances. Messing with the filesystem metadata of live systems is just asking for trouble.
Starting with bftrfs-progs 5.15 space_cache=v2 is the default, so even if it's not been set explicitly, new installs should be using it as far as I'm aware.
What are you using to backup your rootfs and all the subvolumes that the installation creates and then putting it all back?
Nothing special, just tar.
I get that new installs would use space_cache=v2, but there are lots of existing installations so I was wondering if TW would auto migrate existing installations OR if there is a reason that they have purposely not migrated existing installations. In case anyone else is interested, I just tested out in a vm and was able to easily switch between v1 and v2 of space_cache ( and back ) Just add ',clear_cache,space_cache=v2' to the options for the '/' mount in /etc/fstab and reboot. To switch back just change it to v1 and reboot again. Once you have rebooted and have it set to your desired space_cache version, you can remove from /etc/fstab and future reboots will use the last value. -- Regards, Joe
participants (3)
-
Adam Mizerski
-
Joe Salmeri
-
K Scott