[RECOVERY][ROMs] Recovery and Rom for All-F2FS 08/06/14

Search This thread

deedeeceleb

Senior Member
Oct 10, 2011
469
227
I can't manage to boot franco kernel (sabermod with f2fs support) on my n4...
it always gets stuck at google logo :-/
 

jolinnard

Senior Member
Sep 3, 2009
1,183
1,609
I have been away last week... I missed something? I was using f2fs on all partitions with Slimkat (weekly) and my JolieHasYou (Matrix sources and selectable). I can confirm that f2fs it's as good as ext4, or even a bit better. It's stable for me as a daily use.

The only thing that is not working (or I can't find a solution) is to remount /system as RW: Titanium Backup can't or myself using adb shell... Anybody knows a way to do it?

If somebody has any issue we can discuss it, as always. I will try to help (I don't want answer old posts :p)
 

mikaole

Senior Member
Jan 14, 2012
1,364
524
Google Pixel 7 Pro
What do you mean with remount. I am using root explorer to delete the system apps I don't use and can. Rw. Ro the system as much as I like.

Btw chad from velocity would be so kind to make us another bootimage so I could use his kernel beside the slim one. Do you know how to make that, or if not, what changes you have to make to just do a kernel. We can't get his kernel to run and I was not able to find a full github for this.
 
Last edited:

jolinnard

Senior Member
Sep 3, 2009
1,183
1,609
What do you mean with remount. I am using root explorer to delete the system apps I don't use and can. Rw. Ro the system as much as I like.

Btw chad from velocity would be so kind to make us another bootimage so I could use his kernel beside the slim one. Do you know how to make that, or if not, what changes you have to make to just do a kernel. We can't get his kernel to run and I was not able to find a full github for this.

1. I meant this:
Code:
root@android:/ # busybox mount | grep /system
/dev/block/platform/msm_sdcc.1/by-name/system on /system type f2fs (ro,seclabel,nosuid,nodev,noatime,nodiratime,background_gc=off,discard,user_xattr,inline_xattr,acl,errors=recover,active_logs=6)
root@android:/ # busybox mount /system -o remount,rw                           
root@android:/ # busybox mount | grep /system                                  
/dev/block/platform/msm_sdcc.1/by-name/system on /system type f2fs (ro,seclabel,nosuid,nodev,noatime,nodiratime,background_gc=off,discard,user_xattr,inline_xattr,acl,errors=recover,active_logs=6)
As you can see, /system remains in RO. If Root Explorer is capable to remount in RW I need to figure out how...

2. It's hard to know which kernel is "Velocity". Do you have links? Kernel code should be public...
 

jolinnard

Senior Member
Sep 3, 2009
1,183
1,609
Do you know any full github commit for making kernel fullf2fs compatible.
I found something on franco, but that seems not to be all.

For code you can pick this, but you need to enable these options in config too:
Code:
CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
# CONFIG_F2FS_CHECK_FS is not set
 
Last edited:
  • Like
Reactions: mikaole

NABENDU1

Senior Member
May 31, 2012
357
666
MUMBAI
1. I meant this:
Code:
root@android:/ # busybox mount | grep /system
/dev/block/platform/msm_sdcc.1/by-name/system on /system type f2fs (ro,seclabel,nosuid,nodev,noatime,nodiratime,background_gc=off,discard,user_xattr,inline_xattr,acl,errors=recover,active_logs=6)
root@android:/ # busybox mount /system -o remount,rw                           
root@android:/ # busybox mount | grep /system                                  
/dev/block/platform/msm_sdcc.1/by-name/system on /system type f2fs (ro,seclabel,nosuid,nodev,noatime,nodiratime,background_gc=off,discard,user_xattr,inline_xattr,acl,errors=recover,active_logs=6)
As you can see, /system remains in RO. If Root Explorer is capable to remount in RW I need to figure out how...

2. It's hard to know which kernel is "Velocity". Do you have links? Kernel code should be public...

Set SE Linux mode to permissive and try if you can get it to work !!

Maximum velocity kernel
https://github.com/Velocity-Project/mako_kernel
 

jolinnard

Senior Member
Sep 3, 2009
1,183
1,609
Set SE Linux mode to permissive and try if you can get it to work !!

Maximum velocity kernel
https://github.com/Velocity-Project/mako_kernel

Thanks. Finally I can remount it with
Code:
RW -> mount -o remount,rw -t f2fs /dev/block/platform/msm_sdcc.1/by-name/system /system
RO -> mount -o remount,ro -t f2fs /dev/block/platform/msm_sdcc.1/by-name/system /system

About Velocity: do you want to build this kernel with f2fs? Maybe tonight I can play with it...

Also, I made this selectable zip HellsDoctor2_R1-F2FS-selectable.zip. It's running great here ;)
 
  • Like
Reactions: NABENDU1

deedeeceleb

Senior Member
Oct 10, 2011
469
227
Don't know... It's working here.
Only Franco f2fs isn't working, even the selectable one isn't.. :-/

Gesendet von meinem Nexus 4 mit Tapatalk
 

fr3quency

Senior Member
Sep 20, 2008
2,199
856
32
Patra
fr3quency.deviantart.com
Guys, I will write an analytical post flashing F2FS ROMs, other than the one provided in the OP(CM11 version is at the end of the post):


This works for most AOSP-based ROMs(ParanoidAndroid, PSX, Velocity etc have worked for me so far)


1) Download the Modified Recovery PROVIDED IN THE OP

2) Download the FormatPartitions.zip PROVIDED IN THE OP

3) If your ROM is AOSP-based then download the SlimKat ROM PROVIDED IN THE OP (We need its boot.img file).

4) Download your favourite ROM(be it ParanoidAndroid, Velocity, PSX etc)

5) Open your favourite ROM with WinRar/whatever you use and navigate to META-INF\com\google\android\updater-script

6) Open updater-script with Notepad/whatever you use and replace these 2 lines(RESPECTIVELY):

Code:
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");

TO

Code:
run_program("/sbin/mkfs.f2fs", "/dev/block/platform/msm_sdcc.1/by-name/system");
run_program("/sbin/busybox", "mount", "/system");


Note: Notepad on Windows has a replace functionality. It's on Edit---->Replace. So you can paste the stock code and the one you want it to be replaced with. :)

7) Now replace the boot.img inside your FAVOURITE ROM(you can find it when you open the ROM .zip file) with either the one in the MODIFIED SLIMKAT PROVIDED IN THE OP(if it's AOSP-based) or the other one( @WiwiPouPou's one) if it's CM11.

8) Copy FormatPartition.zip which you downloaded to your Phone

9) Reboot to fastboot mode and flash the MODIFIED RECOVERY which you downloaded. The code to do so is:

Code:
fastboot flash recovery the_name_of_the_modified_recovery.img

10) Reboot to Recovery

11) Flash FormatPartitions.zip with new Recovery

12) Reboot recovery

13) Flash your FAVOURITE ROM(which you modified some minutes ago)

14) Flash your favourite Gapps(I installed @BaNkS's Gapps)

15) I don't recommend flashing a custom kernel NOW, because when I did, the WiFi wasn't working. You can flash a kernel later.

16) Go to Wipe Menu and press Format Data (The Big BUTTON!) (You will LOSE all your Data! Music, Pictures, Movies etc!!)

17) Reboot to Android

18) You can now reboot to Recovery and flash your custom Kernel. Be careful though because you need a kernel that supports F2FS. I recommend ak's xGenesis kernel. It works like a charm without any problems.


I followed these steps for converting ParanoidAndroid to F2FS and it worked like a charm. :)




CM11 time

F2FS-based TWRP 2.7.1.0 won't change the partitions to f2fs for me. So you have to do the following:

IGNORE 1, 2 & 3 IF YOUR PARTITIONS ARE ALL-F2FS.

1)Go into recovery

2)type:
Code:
adb shell
mkfs.f2fs /dev/block/mmcblk0p21 (System)
mkfs.f2fs /dev/block/mmcblk0p22 (Cache)
mkfs.f2fs /dev/block/mmcblk0p23 (Data) (Be careful this will delete everything you have)

3) Via using adb push, push the CM11 file, gapps etc into /sdcard. To do that simply type:
Code:
adb push asdf.zip /sdcard (NOTE: the asdf.zip must be in the same folder that adb.exe is)

4)Wipe /system, /data, /cache & dalvik-cache.

5)Install CM11 etc.

6)Install @jolinnard 's kernel: http://xdaforums.com/member.php?u=2002216 (NOTE: I used the ak and it worked, I don't know about the other kernels but I believe they should work as well.)

7)Reboot and have fun with all-f2fs


Note: if it didn't work, just change the 2 lines in the updater-script. You can clearly see the 2 lines that MIGHT need to be replaced at the top of this post. Have fun!



NOTE: If you have successfully converted your partitions to F2FS, you don't need to flash FormatPartitions.zip file & Wipe your Data over and over again. Simply wipe /system, /data & /cache and flash the F2FS ROM you just converted like you would do with any other ROM in the past.


Thanks Nabendu1 for the F2FS code above. Original post of his can be found here: http://www.purespeedx.net/index.php/Thread/269-F2FS-Discussions/?postID=9795#post9795




Latest F2FS Adreno binaries updated on are here: http://xdaforums.com/nexus-4/general/qualcomm-adreno-gpu-binaries-t2667759




So as I pray, UNLIMITED ANDROID WORKS.
 
Last edited:

NABENDU1

Senior Member
May 31, 2012
357
666
MUMBAI
Guys, I will write down an analytical post flashing F2FS ROMs, other than the one provided in the OP:


1)Download the Modified Recovery PROVIDED IN THE OP

2)Download the FormatPartitions.zip PROVIDED IN THE OP

3)Download the SlimKat ROM PROVIDED IN THE OP(We need its boot.img file)

3)Download your favourite ROM(be it CyanogenMod 11, ParanoidAndroid etc)

4)Open your favourite ROM with WinRar/whatever you use and navigate to META-INF\com\google\android\updater-script

5)Open updater-script with Notepad/whatever you use and replace these 2 lines(RESPECTIVELY):

Code:
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");

TO

Code:
run_program("/sbin/mkfs.f2fs", "/dev/block/platform/msm_sdcc.1/by-name/system");
run_program("/sbin/busybox", "mount", "/system");


Note: Notepad on Windows has a replace functionality. It's on Edit---->Replace. So you can paste the stock code with the one you want it to be replaced with. :)

6)Now replace the boot.img inside your FAVOURITE ROM(you can find it when you open the ROM .zip file) with the one in the MODIFIED SLIMKAT PROVIDED IN THE OP

7)Copy FormatPartition.zip which you downloaded to your Phone

8)Reboot to fastboot mode and flash the MODIFIED KERNEL which you downloaded. The code to do so is:

Code:
fastboot flash recovery the_name_of_the_modified_recovery.img

9)Reboot to Recovery

10)Flash FormatPartitions.zip with new Recovery

11)Reboot recovery

12)Flash your FAVOURITE ROM(which you modified some minutes ago)

13)Flash your favourite Gapps(I installed Banks' Gapps)

14)I don't recommend flashing a custom kernel NOW, because when I did, the WiFi wasn't working. You can flash a kernel later.

15)Go to Wipe Menu and press Format Data (The Big BUTTON!) (You will LOSE all your Data! Music, Pictures, Movies etc!!)

16)Reboot to Android

17)You can now reboot to Recovery and flash your custom Kernel. Be careful though because you need a kernel that supports F2FS. I recommend ak's xGensis kernel. It works like a charm without any problems.




I followed these steps for making a ParanoidAndroid F2FS and it worked like a charm. :)



Thanks Nabendu1 for the code above for making it F2FS compatible. Original post of his here: http://www.purespeedx.net/index.php/Thread/269-F2FS-Discussions/?postID=9795#post9795


If you want F2FS Adreno binaries updated on 17/4/2014 I can provide the .zip



So as I pray, UNLIMITED ANDROID WORKS. xD

Nice guide !!

Thanks. Finally I can remount it with
Code:
RW -> mount -o remount,rw -t f2fs /dev/block/platform/msm_sdcc.1/by-name/system /system
RO -> mount -o remount,ro -t f2fs /dev/block/platform/msm_sdcc.1/by-name/system /system
About Velocity: do you want to build this kernel with f2fs? Maybe tonight I can play with it...

Also, I made this selectable zip HellsDoctor2_R1-F2FS-selectable.zip. It's running great here

If you have time and dont mind compiling it then I dont mind !! Anyways if you could compile moob v35 boot.img it could be much more helpful to me since Chad might probably get a F2FS boot.img in d coming days !!
 
Last edited:

jolinnard

Senior Member
Sep 3, 2009
1,183
1,609
I get stuck on the boot logo all f2fs with psx v4 and slimkat kernel. Whats wrong?

Maybe some partition is not well formatted to f2fs. Are you sure PSX's updater-script format /system to f2fs? Also, have you formatted /data and /cache to f2fs?

---------- Post added at 04:44 PM ---------- Previous post was at 04:04 PM ----------

I can't manage to boot franco kernel (sabermod with f2fs support) on my n4...
it always gets stuck at google logo :-/

Please, try this. boot.img is taken from this test version. To revert (if needed), flash ROM+GAPPS+working f2fs kernel as always.
 

NABENDU1

Senior Member
May 31, 2012
357
666
MUMBAI
Maybe some partition is not well formatted to f2fs. Are you sure PSX's updater-script format /system to f2fs? Also, have you formatted /data and /cache to f2fs?

---------- Post added at 04:44 PM ---------- Previous post was at 04:04 PM ----------



Please, try this. boot.img is taken from this test version. To revert (if needed), flash ROM+GAPPS+working f2fs kernel as always.

He has got it resolved !! received a pm from @RedGoblinz !! Was doing something wrong it seems earlier !!

Don't think he will, cause we can't get it to boot.

Dint get you !!

Bdw anyone out here owning a grouper N7 2012 !! Ill be adding support for it too !!
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 31
    Recovery and Rom for All-F2FS

    What is F2FS?

    F2FS (Flash-Friendly File System) is a flash file system created by Kim Jaegeuk at Samsung for the Linux operating system kernel. The motive for F2FS was to build a file system that from the start takes into account the characteristics of NAND flash memory-based storage devices (such as solid-state disks, eMMC, and SD cards), which are widely used in computer systems ranging from mobile devices to servers.

    What is All-F2FS?

    We used F2FS only for /data. It was simply because we have only to flash a compatible Kernel and Format /data partition. With All-F2FS we use F2FS for all partitions and we need a compatible ROM


    Instructions:

    Compatible ROM:

    (All credits to authors. I have only made them compatible with F2FS)

    • Download compatible ROM
    • Download FormatPartitions.zip
    • Download "special" TWRP for All-F2FS: openrecovery-twrp-2.7.1.0-mako-All-F2FS.img
      (This is different for that of simply F2FS)
    • Copy FormatPartitions.zip and ROM on Phone
    • Flash "special" TWRP with Fastboot
    • Flash FormatPartitions.zip with new Recovery
    • Reboot Recovery
    • Flash ROM with new Recovery
    • (Flash GApps with new Recovery)
    • Go to Wipe Menu and press Format Data (The Big BUTTON!) (You will LOSE all your Data! Music, Movies etc!!)
    • Reboot

    (Recovery has a RED back button to remember you that you are using the F2FS recovery!)

    If you get something like "Unable to mount '/cache'", Flash FormatPartitions.zip and reboot recovery.

    Enjoy :)

    Phone is snappy and smooth with All-F2FS.

    2db12xy.png



    To go back:
    - Flash a "normal" recovery
    - Format Data
    - Reboot Recovery
    - Flash RestorePartitions.zip (Untested)
    - Reboot Recovery
    - Flash your previous ROM

    (Required commit)
    23
    Guys, I will write an analytical post flashing F2FS ROMs, other than the one provided in the OP(CM11 version is at the end of the post):


    This works for most AOSP-based ROMs(ParanoidAndroid, PSX, Velocity etc have worked for me so far)


    1) Download the Modified Recovery PROVIDED IN THE OP

    2) Download the FormatPartitions.zip PROVIDED IN THE OP

    3) If your ROM is AOSP-based then download the SlimKat ROM PROVIDED IN THE OP (We need its boot.img file).

    4) Download your favourite ROM(be it ParanoidAndroid, Velocity, PSX etc)

    5) Open your favourite ROM with WinRar/whatever you use and navigate to META-INF\com\google\android\updater-script

    6) Open updater-script with Notepad/whatever you use and replace these 2 lines(RESPECTIVELY):

    Code:
    format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
    mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");

    TO

    Code:
    run_program("/sbin/mkfs.f2fs", "/dev/block/platform/msm_sdcc.1/by-name/system");
    run_program("/sbin/busybox", "mount", "/system");


    Note: Notepad on Windows has a replace functionality. It's on Edit---->Replace. So you can paste the stock code and the one you want it to be replaced with. :)

    7) Now replace the boot.img inside your FAVOURITE ROM(you can find it when you open the ROM .zip file) with either the one in the MODIFIED SLIMKAT PROVIDED IN THE OP(if it's AOSP-based) or the other one( @WiwiPouPou's one) if it's CM11.

    8) Copy FormatPartition.zip which you downloaded to your Phone

    9) Reboot to fastboot mode and flash the MODIFIED RECOVERY which you downloaded. The code to do so is:

    Code:
    fastboot flash recovery the_name_of_the_modified_recovery.img

    10) Reboot to Recovery

    11) Flash FormatPartitions.zip with new Recovery

    12) Reboot recovery

    13) Flash your FAVOURITE ROM(which you modified some minutes ago)

    14) Flash your favourite Gapps(I installed @BaNkS's Gapps)

    15) I don't recommend flashing a custom kernel NOW, because when I did, the WiFi wasn't working. You can flash a kernel later.

    16) Go to Wipe Menu and press Format Data (The Big BUTTON!) (You will LOSE all your Data! Music, Pictures, Movies etc!!)

    17) Reboot to Android

    18) You can now reboot to Recovery and flash your custom Kernel. Be careful though because you need a kernel that supports F2FS. I recommend ak's xGenesis kernel. It works like a charm without any problems.


    I followed these steps for converting ParanoidAndroid to F2FS and it worked like a charm. :)




    CM11 time

    F2FS-based TWRP 2.7.1.0 won't change the partitions to f2fs for me. So you have to do the following:

    IGNORE 1, 2 & 3 IF YOUR PARTITIONS ARE ALL-F2FS.

    1)Go into recovery

    2)type:
    Code:
    adb shell
    mkfs.f2fs /dev/block/mmcblk0p21 (System)
    mkfs.f2fs /dev/block/mmcblk0p22 (Cache)
    mkfs.f2fs /dev/block/mmcblk0p23 (Data) (Be careful this will delete everything you have)

    3) Via using adb push, push the CM11 file, gapps etc into /sdcard. To do that simply type:
    Code:
    adb push asdf.zip /sdcard (NOTE: the asdf.zip must be in the same folder that adb.exe is)

    4)Wipe /system, /data, /cache & dalvik-cache.

    5)Install CM11 etc.

    6)Install @jolinnard 's kernel: http://xdaforums.com/member.php?u=2002216 (NOTE: I used the ak and it worked, I don't know about the other kernels but I believe they should work as well.)

    7)Reboot and have fun with all-f2fs


    Note: if it didn't work, just change the 2 lines in the updater-script. You can clearly see the 2 lines that MIGHT need to be replaced at the top of this post. Have fun!



    NOTE: If you have successfully converted your partitions to F2FS, you don't need to flash FormatPartitions.zip file & Wipe your Data over and over again. Simply wipe /system, /data & /cache and flash the F2FS ROM you just converted like you would do with any other ROM in the past.


    Thanks Nabendu1 for the F2FS code above. Original post of his can be found here: http://www.purespeedx.net/index.php/Thread/269-F2FS-Discussions/?postID=9795#post9795




    Latest F2FS Adreno binaries updated on are here: http://xdaforums.com/nexus-4/general/qualcomm-adreno-gpu-binaries-t2667759




    So as I pray, UNLIMITED ANDROID WORKS.
    10
    Hey guys. I've just published an app that let you convert a Standard ROM to All-F2FS ROM without a computer. Directly on your phone/tablet.

    Convert To F2FS
    https://play.google.com/store/apps/details?id=com.runnerway.converttof2fs

    -lSpP8Rh6vRVew5L72u3ZEh7Vf4d6VDx2kul2ueIhfihJ2Cw0gyDbYiMHVnRI7A9X6A=h900-rw


    So you can convert yourself every ROM you want without troubles.
    Now it's easy to stay up to date with the ROM you like.

    Tested with:
    - SlimROM
    - Cyanogenmod
    Should work with other ROMs too.

    It cost very little, like a coffe.
    I think it's usefull and it's a good way to support my work.
    Thank you. :D
    8
    Yes, I flashed a F2FS kernel. In fact, I am using that kernel with the F2FS version of SlimKat posted in the OP, so I couldn't figure why the newest SlimKat version doesn't work even after modifying those 2 lines in the updater script.

    Ok, lets do a recap please.

    1. We have 3 partition that can be formatted into f2fs: /system (where ROM lives), /data (or userdata, emulated sdcard etc) and /cache
    2. f2fs is not included in stock kernel, so we need a custom kernel patched with f2fs
    3. We need to setup the correct fstab (the filesystem table). This table is inside boot.img (the kernel partition) and it has to fit exactly. What I meant is if you want to have all partitions in f2fs, or only one or two...
    Because of that, many users start to change only /data partition, so in this situation you can use every ROM you want (because all ROMs format /system into ext4 filesystem), but you have to flash a f2fs enabled kernel and set /data into f2fs in fstab. Same if you want /cache too.
    But if you want /system in f2fs, you need to check updater-script into ROM zip. Because, like I said, most of the ROMs specifically format into ext4. This can be changed easily modifying these lines:
    format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
    mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");

    to:
    run_program("/sbin/mkfs.f2fs", "/dev/block/platform/msm_sdcc.1/by-name/system");
    run_program("/sbin/busybox", "mount", "/system");


    The kernel part is the other important part. We need the perfect partition table, so this is what my selectable script does: simply renaming the zip, it setup the correct entry in fstab according the partition you want to mount as f2fs. A couple examples with HellsDoctor selectable:
    - You format /data and /cache in f2fs, you can flash the ROM you want (/system will remain in ext4, stock). Then you download my selectable zip: HellsDoctor_R29-F2FS-selectable.zip, you rename it in HellsDoctor_R29-F2FS-data-cache.zip and you are done. Flash zips in the typical order: ROM + GAPPS + (renamed)kernel.
    - You only want system into f2fs. Well, you don't have to format anything from recovery, because ROM does it every time. So you need to change updater-script of your favorite ROM or you can use Slimkat posted in the OP, or another one that has these 2 lines in f2fs. Rename HellsDoctor_R29-F2FS-selectable.zip into HellsDoctor_R29-F2FS-system.zip and flash as always: ROM + GAPPS + (renamed)kernel
    - And so on...

    It's a bit complicated for me to explain this easily in English ... but I'm trying to. Thanks for your patience ;)
    6
    New selectable zip

    Hi!

    After code a little bit, I make a zip that is "selectable". Is not as advanced as "aroma" but it should work and it will be easy to understand:

    - Download the zip: HellsDoctor R29 for the moment
    - Rename with desired partitions to mount as f2fs. For instance if you want all f2fs:
    HellsDoctor_R29-F2FS-selectable.zip --> HellsDoctor_R29-F2FS-data-cache-system.zip

    or if you want only /data:
    HellsDoctor_R29-F2FS-data.zip

    or data and cache:
    HellsDoctor_R29-F2FS-data-cache.zip

    The order as well as punctuation are not important (don't use spaces btw). But remember to write the correct words, only these 3 are accepted:
    • system
    • data
    • cache

    Basically all the job consist to generate a fstab during the flash process by this script kernel/smart-fstab-generator.sh. Feel free to adopt it if you desire.

    Greetings