Btrfs for save changes file
- istinnjazz
- Samurai
- Posts: 115
- Joined: 15 May 2016, 14:10
- Distribution: Manjaro-OpenRC/Nemesis
Btrfs for save changes file
I was wondering if a btrfs file system is possible for a changes file. I have formated one to test but it does not seem to work. I am not thinking of any benefit from it right now instead of an ext3/4, just testing it [in nemesis 3.5]
Re: Btrfs for save changes file
I used btrfs for quite a while with Porteus.
I moved on after the file system locked on me.
I'm sure it works... it just appears to require certain pre-conditions.
I will research this tonight and report my findings tomorrow.
Unless someone else elaborates.
I moved on after the file system locked on me.
I'm sure it works... it just appears to require certain pre-conditions.
I will research this tonight and report my findings tomorrow.
Unless someone else elaborates.
- istinnjazz
- Samurai
- Posts: 115
- Joined: 15 May 2016, 14:10
- Distribution: Manjaro-OpenRC/Nemesis
Re: Btrfs for save changes file
just for reference
commands used:
could the dd "bs" parameter be a problem?
edit: nope, tested with 64k also
commands used:
Code: Select all
dd if=/dev/zero of=save-bt2.dat bs=1M count=128
mkfs.btrfs save-bt2.dat
edit: nope, tested with 64k also
- istinnjazz
- Samurai
- Posts: 115
- Joined: 15 May 2016, 14:10
- Distribution: Manjaro-OpenRC/Nemesis
Re: Btrfs for save changes file
I realized that btrfs kernel module is not loaded with my custom kernel, even if I can use those commands of the btrfs tools and I can also manually mount it. But not at boot run level.
Maybe it has to be compiled in kernel core and not as a module, I do not know if it can be loaded at boot as a module. This is probably the issue. Can I pass a kernel parameter to load btrfs module at boot before changes param at porteus.cfg?
Code: Select all
root /home/guest # modinfo btrfs
filename: /lib/modules/4.5.5-xanmod8-porteus/kernel/fs/btrfs/btrfs.ko
license: GPL
alias: devname:btrfs-control
alias: char-major-10-234
alias: fs-btrfs
depends: raid6_pq,xor,zlib_deflate
intree: Y
vermagic: 4.5.5-xanmod8-porteus SMP preempt mod_unload
- francois
- Contributor
- Posts: 6499
- Joined: 28 Dec 2010, 14:25
- Distribution: xfce plank porteus nemesis
- Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.
Re: Btrfs for save changes file
Could this be of some help:
http://www.yodaconditions.com/dokuwiki/ ... tall.btrfs
http://www.yodaconditions.com/dokuwiki/ ... tall.btrfs
Prendre son temps, profiter de celui qui passe.
- brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Re: Btrfs for save changes file
udev handles all the kernel module loading but you can put the modules you want to load in /etc/rc.d/rc.modules
modprobe btrfs
In your case you may need to compile btrfs into the kernel or unpack initrd.xz and add the modprobe command into linuxrc
modprobe btrfs
In your case you may need to compile btrfs into the kernel or unpack initrd.xz and add the modprobe command into linuxrc
How do i become super user?
Wear your underpants on the outside and put on a cape.
Wear your underpants on the outside and put on a cape.
- istinnjazz
- Samurai
- Posts: 115
- Joined: 15 May 2016, 14:10
- Distribution: Manjaro-OpenRC/Nemesis
Re: Btrfs for save changes file
Ok, i have extracted intrd, have edited linuxrc adding "modprobe btrfs" at the end of code (so core xmz will load first and command will find the module).
to create the new initrd i have used:
and of course set the new entry in porteus.cfg
I do not know if it really can find and load the module from the core xzm, initrd is working and booting but module can not be loaded again.
I will have to recompile, and use a new vmlinuz to be sure. But it would be good to know a way that works for modules in initrd level.
to create the new initrd i have used:
Code: Select all
find . | cpio --create --format='newc' > /mnt/sdb5/linux/tmp/newinit-btrfs
I do not know if it really can find and load the module from the core xzm, initrd is working and booting but module can not be loaded again.
I will have to recompile, and use a new vmlinuz to be sure. But it would be good to know a way that works for modules in initrd level.
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: Btrfs for save changes file
@ istinnjazz
If you can bear with me will provide you all the steps of what I know should work. 8)
If you can bear with me will provide you all the steps of what I know should work. 8)
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
- istinnjazz
- Samurai
- Posts: 115
- Joined: 15 May 2016, 14:10
- Distribution: Manjaro-OpenRC/Nemesis
Re: Btrfs for save changes file
@ Bogomips
there is no hurry, take your time
.
Keep in mind that I use nemesis 3.5, the arch based porteus
there is no hurry, take your time

Keep in mind that I use nemesis 3.5, the arch based porteus
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: Btrfs for save changes file
No worries. Will do example without being confined to single distro.istinnjazz wrote:Keep in mind that I use nemesis 3.5, the arch based porteus

- Get kriss's script enhanced from http://forum.porteus.org/viewtopic.php? ... =15#p41205
- Name it punpin.sh
Code: Select all
mkdir ird cp /Path/to/initrd.xz ird sh ../punpin.sh
- Edit linuxrc:
Code: Select all
#====================================== # ENTRY (Put this right at the start!) #-------------------------------------- . modprobe btrfs # 2016-07-27 ## Let's start! mount -nt devtmpfs none /dev
- Looks like there is already a kernel module: /lib/modules/`uname -r`/kernel/fs/btrfs/btrfs.ko available.
- Add the module. (For this exercise we'll use: /lib/modules/4.1.15/kernel/fs/btrfs/btrfs.ko)
Code: Select all
cd /home/guest cp --parents /lib/modules/4.1.15/kernel/fs/btrfs/btrfs.ko ird
- Do Dependency
Code: Select all
mkdir -p dep/lib/modules/4.1.15 cp -a /lib/modules/4.1.15/kernel dep/lib/modules/4.1.15 /sbin/depmod -b dep 4.1.15
- Should now have something like:
Code: Select all
guest@porteus:~$ ls dep/lib/modules/4.1.15/ kernel/ modules.alias.bin modules.dep modules.devname modules.symbols modules.alias modules.builtin.bin modules.dep.bin modules.softdep modules.symbols.bin
Code: Select all
cp -p dep/lib/modules/4.1.15/* ird/lib/modules/4.1.15
- Pack Initrd:
Code: Select all
cd ird sh ../punpin.sh xz cd .. # Assuming same directory as for initrd.xz cp -p newinitrd.xz /Path/to/newinitrd.xz
- Testing. At the boot screen hit tab key, in order to edit entry. Replace initrd.xz with newinitrd.xz
- Good Luck!
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
- istinnjazz
- Samurai
- Posts: 115
- Joined: 15 May 2016, 14:10
- Distribution: Manjaro-OpenRC/Nemesis
Re: Btrfs for save changes file
Thanks, I will try it
It is good to have same good instructions to deal with initd, I have never touched it and it seems very selective on the way it has to be packed.
To sum up some of my findings, if correct
1. If we will change/upgrade kernel, modules directory inside initrd becomes obsolete and/or possibly incompatible
2. It seems that the save.dat file is being read before anything else in the union sequence. And I guess is impossible if not designed as such, to have a special xzm with those modules so initrd can access them before loading save.dat outside of the initrd itself. But this seems specific and rare, so not much of a deal here.
3. It seems a good method in cases where exotic/old drivers or special fs has to be recognized upon boot. I have already a kernel panic on an old machine upon boot and I suspect there is a chip/set driver as a module behind this (some other distros boot ok).
Anyway, I think it is better (for this particular case) to recompile kernel with core btrfs in my next upgrade and keep initrd intact.
Thanks for your method.
P.S. I will test Btrfs, it seems there is future in this and it seems relatively stable on latest versions. I have read good opinions about it compared to ext4 especially for failure recovery. I want to test its behavior in savefile mode, https://wiki.archlinux.org/index.php/Btrfs.
It is good to have same good instructions to deal with initd, I have never touched it and it seems very selective on the way it has to be packed.
To sum up some of my findings, if correct
1. If we will change/upgrade kernel, modules directory inside initrd becomes obsolete and/or possibly incompatible
2. It seems that the save.dat file is being read before anything else in the union sequence. And I guess is impossible if not designed as such, to have a special xzm with those modules so initrd can access them before loading save.dat outside of the initrd itself. But this seems specific and rare, so not much of a deal here.
3. It seems a good method in cases where exotic/old drivers or special fs has to be recognized upon boot. I have already a kernel panic on an old machine upon boot and I suspect there is a chip/set driver as a module behind this (some other distros boot ok).
Anyway, I think it is better (for this particular case) to recompile kernel with core btrfs in my next upgrade and keep initrd intact.
Thanks for your method.
P.S. I will test Btrfs, it seems there is future in this and it seems relatively stable on latest versions. I have read good opinions about it compared to ext4 especially for failure recovery. I want to test its behavior in savefile mode, https://wiki.archlinux.org/index.php/Btrfs.
-
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Re: Btrfs for save changes file
A quick glance at an annotated linuxrc, seems to confirm that changes are processed before modules dealt with.istinnjazz wrote:2. It seems that the save.dat file is being read before anything else in the union sequence.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
- istinnjazz
- Samurai
- Posts: 115
- Joined: 15 May 2016, 14:10
- Distribution: Manjaro-OpenRC/Nemesis
Re: Btrfs for save changes file
I compiled with btrfs as a part of the kernel, btrfs save.dat loads and saves OK.
I had also compiled with F2FS as a part of the kernel, I will probably test it some day
Code: Select all
root /home/guest # dmesg | grep BTRFS
[ 5.853178] BTRFS: device fsid 78050861-e19d-49fa-974a-8cd8af3aeeb5 devid 1 transid 18 /dev/loop0
[ 5.857306] BTRFS info (device loop0): disk space caching is enabled
[ 5.857308] BTRFS: has skinny extents
Code: Select all
root /home/guest # dmesg | grep F2FS
[ 5.849154] F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 5.849157] F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
[ 5.849200] F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 5.849202] F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock
[ 5.849206] F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 5.849208] F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
[ 5.849210] F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 5.849211] F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock
root /home/guest #