[opensuse-factory] Converting btrfs to new var subvolume
Hi list, I just had a try at converting my old TW installation on the laptop (installed 2016.08) to the new one-var-only subvolume scheme. (I have deleted all snapshots except the currently used one before starting, maybe daring, but I didn't want that to interfere. In hindsight leaving one around should be the safer option? But you cannot roll back to those anyhow after the subvolumes are deleted...) /var is in use permanently, so I decided to do this offline, booting from another system (install system / USB should be fine) I used the test install I did yesterday, on external USB disk /dev/sdb. My old, main system (i.e., the btrfs root) is on disk /dev/sda4 Here's what I did: # mount top level mount -o subvol=/ /dev/sda4 /mnt # /var exists, so new name btrfs subvolume create /mnt/@/newvar # Now fill the new /var with old content from snapshot and var subvolumes. # I'm still on the original snapshot, never did a rollback. So: rsync -avr /mnt/@/.snapshots/1/snapshot/var/ /mnt/@/newvar/ rsync -avr /mnt/@/var/ /mnt/@/newvar/ # Set the no-copy-on-write flag chattr -fR +C /mnt/@/newvar # adapt fstab to the new layout vi /mnt/@/.snapshots/1/snapshot/etc/fstab # comment out all the old /var/* subvolume mounts, and add UUID=<your-uuid-same-as-others> /var btrfs subvol=@/newvar 0 0 At this stage I rebooted back to the old system, which is where I'm typing now I got a complaint that /var was not empty when @/newvar was mounted over, but that is harmless (and expected). So far I have no issues at all, and I will now continue to remove the old subvolume and double data. This can in principle be done from the running system, but I also want to change the name of newvar to var, after all subvolumes are deleted. So I'll boot the other system once more and mount -o subvol=/ /dev/sda4 /mnt btrfs subvolume list / | grep /var/ | cut -d@ -f2 | \ while read v; do brtfs subvolume delete /mnt/@${v} ; done btrfs subvolume sync /mnt rm -rf /mnt/@/var mv /mnt/@/newvar /mnt/@/var # official(?) way to rename subvolumes # the snapshot still has some data in /var. Delete it rm -rf /mnt/@/.snapshots/1/snapshot/var/* # Dont forget to change mount entry sed -i -e 's/newvar/var/' /mnt/@/.snapshots/1/snapshot/etc/fstab # newvar->var umount /mnt reboot curageous people might do this already in the first part - I wanted the old stuff to be around in case I mess up.... Don't follow this blindly, but maybe some find it usefull to convert their own system without re-installing from scratch... Cheers, Pit -- Dr. Peter "Pit" Suetterlin http://www.astro.su.se/~pit Institute for Solar Physics Tel.: +34 922 405 590 (Spain) P.Suetterlin@royac.iac.es +46 8 5537 8558 (Sweden) Peter.Suetterlin@astro.su.se -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Fri, Feb 9, 2018 at 2:10 PM, Peter Suetterlin
Hi list,
I just had a try at converting my old TW installation on the laptop (installed 2016.08) to the new one-var-only subvolume scheme. (I have deleted all snapshots except the currently used one before starting, maybe daring, but I didn't want that to interfere. In hindsight leaving one around should be the safer option? But you cannot roll back to those anyhow after the subvolumes are deleted...)
/var is in use permanently, so I decided to do this offline, booting from another system (install system / USB should be fine) I used the test install I did yesterday, on external USB disk /dev/sdb.
My old, main system (i.e., the btrfs root) is on disk /dev/sda4
Here's what I did:
# mount top level mount -o subvol=/ /dev/sda4 /mnt # /var exists, so new name btrfs subvolume create /mnt/@/newvar
# Now fill the new /var with old content from snapshot and var subvolumes. # I'm still on the original snapshot, never did a rollback. So:
rsync -avr /mnt/@/.snapshots/1/snapshot/var/ /mnt/@/newvar/ rsync -avr /mnt/@/var/ /mnt/@/newvar/
The above confuses me. How do you rsync from /mnt/@/.snapshots and /mnt/@/var/ I did not think /mnt/@ (aka /@) existed yet (i.e., in the older TW layout). -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Roger Oberholtzer wrote:
On Fri, Feb 9, 2018 at 2:10 PM, Peter Suetterlin
wrote: Hi list,
I just had a try at converting my old TW installation on the laptop (installed 2016.08) to the new one-var-only subvolume scheme. (I have deleted all snapshots except the currently used one before starting, maybe daring, but I didn't want that to interfere. In hindsight leaving one around should be the safer option? But you cannot roll back to those anyhow after the subvolumes are deleted...)
/var is in use permanently, so I decided to do this offline, booting from another system (install system / USB should be fine) I used the test install I did yesterday, on external USB disk /dev/sdb.
My old, main system (i.e., the btrfs root) is on disk /dev/sda4
Here's what I did:
# mount top level mount -o subvol=/ /dev/sda4 /mnt # /var exists, so new name btrfs subvolume create /mnt/@/newvar
# Now fill the new /var with old content from snapshot and var subvolumes. # I'm still on the original snapshot, never did a rollback. So:
rsync -avr /mnt/@/.snapshots/1/snapshot/var/ /mnt/@/newvar/ rsync -avr /mnt/@/var/ /mnt/@/newvar/
The above confuses me. How do you rsync from /mnt/@/.snapshots and /mnt/@/var/
I did not think /mnt/@ (aka /@) existed yet (i.e., in the older TW layout).
Oh - how old is that? My system from 2016 does have the @. I wasn't aware there was a version without it. I guess for those an update path is more complicated, though it *should* be doable, too. In doubt by creating it, and then either - just move the subvolumes around (but I do not know if this works) - create new subvolumes below @, rsync the stuff over from the old ones, delete the latter But that is guessing - I don't have such a system around for playing. I can create a FS layout and see if the above works, but that would not verify that a *real* system would still boot I'm afraid... -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Peter Suetterlin wrote: small glitch:
mount -o subvol=/ /dev/sda4 /mnt btrfs subvolume list / | grep /var/ | cut -d@ -f2 | \ while read v; do brtfs subvolume delete /mnt/@${v} ; done
that should of course be btrfs subvolume list /mnt apart from that the recipe worked as I hoped :) -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Fri, Feb 9, 2018 at 2:37 PM, Peter Suetterlin
Peter Suetterlin wrote:
small glitch:
mount -o subvol=/ /dev/sda4 /mnt btrfs subvolume list / | grep /var/ | cut -d@ -f2 | \ while read v; do brtfs subvolume delete /mnt/@${v} ; done
that should of course be btrfs subvolume list /mnt
apart from that the recipe worked as I hoped :)
This would, I guess, be limited to Tumbleweed? Leap 42.3 will never use this? Perhaps starting with Leap 15.0 this will happen? -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Roger Oberholtzer wrote:
This would, I guess, be limited to Tumbleweed? Leap 42.3 will never use this?
I think so. Leap still has many things in /var that are snapshot-dependent, starting with rpm.
Perhaps starting with Leap 15.0 this will happen?
Haven't looked into that so far. There have been remarks 15.0 follows TW, then either you already get the new layout when you install, or the coversion should be possible like in TW. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On 9 February 2018 at 16:30, Peter Suetterlin
Roger Oberholtzer wrote:
This would, I guess, be limited to Tumbleweed? Leap 42.3 will never use this?
I think so. Leap still has many things in /var that are snapshot-dependent, starting with rpm.
Correct, there is no way that following Peter's guide would be a good thing for anyone running Leap 42.3 or earlier
Perhaps starting with Leap 15.0 this will happen?
Haven't looked into that so far. There have been remarks 15.0 follows TW, then either you already get the new layout when you install, or the coversion should be possible like in TW.
Leap 15.0 should be safe to use this approach, and the packages required should all be there and happy and healthy. But the Leap 15.0 control file (so new Leap 15 installations) do not honour this new approach yet It should once https://build.opensuse.org/request/show/571135 is accepted -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
participants (3)
-
Peter Suetterlin
-
Richard Brown
-
Roger Oberholtzer