Forum

Full Version: Btrfs is broken
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So, after a few seconds the filesystem is on read_only so I cannot restore btrfs from a snapshot.

Terminal
xbian@xbian ~ $ sudo btrfs-auto-snapshot list root
Error: unable to mount the filesystem

Is there any way I can put to work a snapshot from ubuntu?
I've downloaded the script btrfs-auto-snapshot but I cannot make it work for a /media partition in ubuntu. I am not fully confident with what it does when "restoring".

https://github.com/mk01/btrfs-auto-snapshot/blob/master/btrfs-auto-snapshot
Never mind, back to restore the default image. You can close this thread if you want.
(26th Oct, 2018 06:28 PM)chochis Wrote: [ -> ]So, after a few seconds the filesystem is on read_only so I cannot restore btrfs from a snapshot.

Terminal
xbian@xbian ~ $ sudo btrfs-auto-snapshot list root
Error: unable to mount the filesystem

Is there any way I can put to work a snapshot from ubuntu?

The main problem is that XBian is using LZ4 as compression which is not included in standard distributions. So It's not possible without a patched kernel

In the future (or should I say since one week), LZ4 compression has been suspended since it does not work stable since kernel 4.15, see this commit and starting with kernel 4.18, the LZ4 patch has been removed completely

Quote:I've downloaded the script btrfs-auto-snapshot but I cannot make it work for a /media partition in ubuntu. I am not fully confident with what it does when "restoring".

FYI: you do not need btrfs-auto-snapshot to restore a snapshot. Just mount sd (if your kernel allows this - see above), move into ./root subvol and you will see all the snapshots you have. A rename of @ to @-bad and then any @... to @ will revert the subvol to that snapshot

To repair a broken BTRFS fs, the common way is to turn into the rescue mode (included in initramfs, so it need to be enabled) and then run btrfs check /dev/mmcblk0p2
(27th Oct, 2018 12:18 AM)chochis Wrote: [ -> ]Never mind, back to restore the default image. You can close this thread if you want.

Set to solved
(27th Oct, 2018 04:54 AM)Nachteule Wrote: [ -> ]The main problem is that XBian is using LZ4 as compression which is not included in standard distributions. So It's not possible without a patched kernel

In the future (or should I say since one week), LZ4 compression has been suspended since it does not work stable since kernel 4.15, see this commit and starting with kernel 4.18, the LZ4 patch has been removed completely

Hmmm ok so if 4.15 have issues with LZ4 what do we with LZ4 active do? Is it safe to update to 4.15?

Also what is the new compression by default on new images?
(13th Nov, 2018 07:14 AM)Exnor Wrote: [ -> ]Hmmm ok so if 4.15 have issues with LZ4 what do we with LZ4 active do? Is it safe to update to 4.15?

Also what is the new compression by default on new images?

4.15 - 4.17 was never build, so you can't install it.

4.18 and 4.19 kernels are available in devel repo, and installation procedure checks if fs is mounted with LZ4 compression and will refuse to install in that case. But, it does not check if LZ4 compressed extends are already on the disk.
In that case, installing kernel 4.18 or higher will break current installation (fs would not be destroyed, but not longer mountable)

LZO - that has never been changed (image was always created with LZO compression enabled)
(13th Nov, 2018 07:27 AM)Nachteule Wrote: [ -> ]4.15 - 4.17 was never build, so you can't install it.

4.18 and 4.19 kernels are available in devel repo, and installation procedure checks if fs is mounted with LZ4 compression and will refuse to install in that case. But, it does not check if LZ4 compressed extends are already on the disk.
In that case, installing kernel 4.18 or higher will break current installation (fs would not be destroyed, but not longer mountable)

LZO - that has never been changed (image was always created with LZO compression enabled)

So in the future when you guys move the 4.18 or above from devel to main what can we do?
Is there a way to change the compression?

Also i kind of remember asking why we were using LZ4 some year ago here in the forum (or because i was having some random crashes)... are you sure LZO has always been the default compression? Because my current install/image is pretty old (as been updated/upgraded for years up to current) and i don't remember changing the compression type, and somehow its set to LZ4....

Thanks
(13th Nov, 2018 08:36 AM)Exnor Wrote: [ -> ]So in the future when you guys move the 4.18 or above from devel to main what can we do?
Is there a way to change the compression?

There is no simple way to change compression of already compressed LZ4 extends

Possible 2 solutions:
1) Reinstall from new image (will probably most user do)
2.1) Change compression to LZO (if not already done in /boot/cmdline.txt), reboot, make complete image backup (xbian-config, function Copier)
2.2) Reflash this image

Quote:Also i kind of remember asking why we were using LZ4 some year ago here in the forum (or because i was having some random crashes)... are you sure LZO has always been the default compression? Because my current install/image is

Yes, absolutely sure. The switch to LZ4 compression is done when newly flashed image is booted the first time without change compression from LZ4 to LZO before that first boot

Quote:pretty old (as been updated/upgraded for years up to current) and i don't remember changing the compression type, and somehow its set to LZ4....

Sure, you never did it. That's because LZ4 compression was already set to LZ4 for the first boot.
(13th Nov, 2018 09:32 AM)Nachteule Wrote: [ -> ]There is no simple way to change compression of already compressed LZ4 extends

Possible 2 solutions:
1) Reinstall from new image (will probably most user do)
2) Change compression to LZO (if not already done in /boot/cmdline.txt), reboot, make complete image backup (xbian-config, function Copier)
3) Reflash this image

Quote:Also i kind of remember asking why we were using LZ4 some year ago here in the forum (or because i was having some random crashes)... are you sure LZO has always been the default compression? Because my current install/image is

Yes, absolutely sure. The switch to LZ4 compression is done when newly flashed image is booted the first time without change compression from LZ4 to LZO before that first boot

Quote:pretty old (as been updated/upgraded for years up to current) and i don't remember changing the compression type, and somehow its set to LZ4....

Sure, you never did it. That's because LZ4 compression was already set to LZ4 for the first boot.

So if make a backup using the Function Copier and the restore it on a fresh install will it copy the extra packages I've installed? Or is just like copying the /home folder?

You said there is no easy way to change the compression, but is there a way? I actually prefer to have that extra work than to do a fresh install.... I hate to reconfigure my machines from scratch. :/
(14th Nov, 2018 04:33 AM)Exnor Wrote: [ -> ]So if make a backup using the Function Copier and the restore it on a fresh install will it copy the extra packages I've installed? Or is just like copying the /home folder?

IF you set as destination: file:/destination-path/backup.img,

A complete image of everything will be stored in backup.img

Quote:You said there is no easy way to change the compression, but is there a way? I actually prefer to have that extra work than to do a fresh install.... I hate to reconfigure my machines from scratch. :/

See above. You don't have to configure anything again if you reflash your backup.img file

To get rid of LZ4 compressed extends could be (theoretically)

1) enable LZO compression
2) reboot
3) mount /dev/root /mnt for example
4) remove all existing snapshorts in /mnt/*/@-* expect @
5) create new subvols in /mnt/*/@-lzo
6) copy all data from /mnt/*/@ to /mnt/*/@-lzo
7) rename all /mnt/*/@ to /mnt/*/@-lz4
8) rename all /mnt/*/@-lzo to /mnt/*/@
9) reboot
10) mount /dev/root again and remove all @-lz4 subvols

You see, not so easy and a lot of stress for the sd-card. Backup and reflash is much easier
(14th Nov, 2018 05:17 AM)Nachteule Wrote: [ -> ]
(14th Nov, 2018 04:33 AM)Exnor Wrote: [ -> ]So if make a backup using the Function Copier and the restore it on a fresh install will it copy the extra packages I've installed? Or is just like copying the /home folder?

IF you set as destination: file:/destination-path/backup.img,

A complete image of everything will be stored in backup.img

Quote:You said there is no easy way to change the compression, but is there a way? I actually prefer to have that extra work than to do a fresh install.... I hate to reconfigure my machines from scratch. :/

See above. You don't have to configure anything again if you reflash your backup.img file

To get rid of LZ4 compressed extends could be (theoretically)

1) enable LZO compression
2) reboot
3) mount /dev/root /mnt for example
4) remove all existing snapshorts in /mnt/*/@-* expect @
5) create new subvols in /mnt/*/@-lzo
6) copy all data from /mnt/*/@ to /mnt/*/@-lzo
7) rename all /mnt/*/@ to /mnt/*/@-lz4
8) rename all /mnt/*/@-lzo to /mnt/*/@
9) reboot
10) mount /dev/root again and remove all @-lz4 subvols

You see, not so easy and a lot of stress for the sd-card. Backup and reflash is much easier

Hmm it does seem a lot of work and write operations on the sdcard....

The image.img does not keep the same file system like a ghost utility?

Also if i do that, should i put the image file on the correct directory on the 1st boot or can i do it at any time?
And finaly, are the current installation images updated and set to lzo?


Thanks
(15th Nov, 2018 08:33 AM)Exnor Wrote: [ -> ]Hmm it does seem a lot of work and write operations on the sdcard....

You have asked ...

Quote:The image.img does not keep the same file system like a ghost utility?

All files are completely rewritten in the new image with the current active compression type.

That's why you have to switch to LZO before generating the image

Quote:Also if i do that, should i put the image file on the correct directory on the 1st boot or can i do it at any time?

You did not understand: You have to flash this image to sd-card with an image writer of your choice. I explained the procedures already in 1) 2.1) 2.2).

Quote:And finaly, are the current installation images updated and set to lzo?

Already written here: YES
(15th Nov, 2018 08:53 AM)Nachteule Wrote: [ -> ]You have asked ...

Yes i did and i thank you for that. You were right its kinda a lot more work.

Quote:All files are completely rewritten in the new image with the current active compression type.

That's why you have to switch to LZO before generating the image

Hmm ok so if set to LZO the image will be created with that compression and will not revert to LZ4. I'm i understanding this correctly? (sorry i really don't know the inner works for the filesystem and the Kernel)

Quote:You did not understand: You have to flash this image to sd-card with an image writer of your choice. I explained the procedures already in 1) 2.1) 2.2).

Sorry about my misunderstanding. I was under the impression that i had to download the default image, set the compression to LZO and then place the "backup" on the restore (is this the correct directory?) directory.

So let me see if i understand this correctly. Using the make an image option, i will get a fully flashable / ready to use image of all of my current installation (all partitions, settings etc including the boot partition). All i need is to set LZO and reboot then make the image, etc, etc , etc currect?

Two Last questions:

If i change the compression to LZO (its set as LZ4) will the system still boot? If so then:

After i re-flash the backup image and since i'm still below kernel 4.15, will the system revert back to LZ4 again or the " zswap.compressor=lzo" setting will prevent that?

Also is it a O (letter) or a 0 (zero) on LZO, and is it case sensitive?

Thank you for all the help Smile
(16th Nov, 2018 04:16 AM)Exnor Wrote: [ -> ]Sorry about my misunderstanding. I was under the impression that i had to download the default image, set the compression to LZO and then place the "backup" on the restore (is this the correct directory?) directory.

You have to specify destination folder, this can be a mounted network folder or a folder on a external usb drive. And of course, it would not make sense to store a image backup on a medium I make the backup from.

Quote:So let me see if i understand this correctly. Using the make an image option, i will get a fully flashable / ready to use image of all of my current installation (all partitions, settings etc including the boot partition). All i need is to set LZO and reboot then make the image, etc, etc , etc currect?

Not all partitions, all volumes in the root file system. Additional partitions (for example swap partition) are not included
And, if you have a special configuration which differs from the standard (for example running NOOBS/PINN, or having root fs or /home on external disk/usb stick, it is much more complicated and is not supported by building backup image

Quote:Two Last questions:

If i change the compression to LZO (its set as LZ4) will the system still boot? If so then:

Hey, it would not make sense to write "switch to LZO compression and reboot" if reboot would not work

Quote:After i re-flash the backup image and since i'm still below kernel 4.15, will the system revert back to LZ4 again or the " zswap.compressor=lzo" setting will prevent that?

Also is it a O (letter) or a 0 (zero) on LZO, and is it case sensitive?

Ohhhhhh, and it's case sensitive, as usual. And no, there are no gizmo's in the system which switch back to LZ4: This would make the whole procedure ad absurdum
(16th Nov, 2018 04:46 AM)Nachteule Wrote: [ -> ]You have to specify destination folder, this can be a mounted network folder or a folder on a external usb drive. And of course, it would not make sense to store a image backup on a medium I make the backup from.

Sure that i already had figure lol... Does it support smb shares?


Quote:Not all partitions, all volumes in the root file system. Additional partitions (for example swap partition) are not included
And, if you have a special configuration which differs from the standard (for example running NOOBS/PINN, or having root fs or /home on external disk/usb stick, it is much more complicated and is not supported by building backup image

When you say additional partitions.... any partition that is not included by default right? (and the swap one is recreated after the backup image is re-flashed? Or is not even needed?) So does that include the Boot partition?
And no i did not made any modifications to the Xbian image, just the constant updates and added some apps like Nmon... no extra partitions or anything else.

Quote:Ohhhhhh, and it's case sensitive, as usual. And no, there are no gizmo's in the system which switch back to LZ4: This would make the whole procedure ad absurdum

So uppercase LZO and not lzo (lowercase), right?

Sorry for nagging but i just want to make sure i don't end up having to flash a new image and reconfigure all from scratch.

Thanks
Pages: 1 2
Reference URL's