data分区格式f2fs改为ext4

问题:设备是不带电池的,关机的时候是直接断电的,如果data分区是f2fs的文件系统格式,这种操作是有一定概率性损坏文件系统了导致开不了机。f2fs改为ext4就可以减小异常掉电后数据丢失的概率。

异常开机:

 

 

正常开机会有很多init的信息:

 

 

措施:data分区改成ext4的格式文件系统:

Android7.1+rk3288:

device/rockchip/rk3288:

diff --git a/device.mk b/device.mk
index 5d05a56..cdf512e 100755
--- a/device.mk
+++ b/device.mk
@@ -25,13 +25,13 @@ PRODUCT_PACKAGES += \
     displayd
 
 #enable this for support f2fs with data partion
-BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
+#BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
 
 # This ensures the needed build tools are available.
 # TODO: make non-linux builds happy with external/f2fs-tool; system/extras/f2fs_utils
-ifeq ($(HOST_OS),linux)
-  TARGET_USERIMAGES_USE_F2FS := true
-endif
+#ifeq ($(HOST_OS),linux)
+#  TARGET_USERIMAGES_USE_F2FS := true
+#endif
 
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/init.rk3288.rc:root/init.rk3288.rc \
diff --git a/fstab.rk30board.bootmode.emmc.rk3288 b/fstab.rk30board.bootmode.emmc.rk3288
old mode 100644
new mode 100755
index e753b7d..1bc021b
--- a/fstab.rk30board.bootmode.emmc.rk3288
+++ b/fstab.rk30board.bootmode.emmc.rk3288
@@ -9,8 +9,9 @@
 /dev/block/platform/ff0f0000.dwmmc/by-name/vendor0          /vendor              ext4      ro,noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard                wait
 /dev/block/platform/ff0f0000.dwmmc/by-name/cache          /cache              ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard                wait,check
 /dev/block/platform/ff0f0000.dwmmc/by-name/metadata       /metadata           ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard                wait,check
-/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev,discard,inline_xattr                   wait,check,notrim,encryptable=/metadata/key_file
-#/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard,errors=panic   wait,check,encryptable=/metadata/key_file
+#/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev,discard,inline_xattr                   wait,check,notrim,encryptable=/metadata/key_file
+/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev
                                                                                        wait,check,notrim,encryptable=/metadata/key_file
+/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard,errors=panic   wait,check,encryptable=/metadata/key_file
 /dev/block/platform/ff0f0000.dwmmc/by-name/misc         /misc               emmc      defaults     defaults
 # /dev/block/platform/ff0f0000.dwmmc/by-name/radical_update /radical_update     ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard          wait
 
diff --git a/fstab.rk30board.bootmode.emmc.rk3288w b/fstab.rk30board.bootmode.emmc.rk3288w
old mode 100644
new mode 100755
index 05d7f16..8129ddd
--- a/fstab.rk30board.bootmode.emmc.rk3288w
+++ b/fstab.rk30board.bootmode.emmc.rk3288w
@@ -9,8 +9,9 @@
 /dev/block/platform/ff0f0000.dwmmc/by-name/vendor1          /vendor              ext4      ro,noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard                wait
 /dev/block/platform/ff0f0000.dwmmc/by-name/cache          /cache              ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard                wait,check
 /dev/block/platform/ff0f0000.dwmmc/by-name/metadata       /metadata           ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard                wait,check
-/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev,discard,inline_xattr                   wait,check,notrim,encryptable=/metadata/key_file
-#/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard,errors=panic   wait,check,encryptable=/metadata/key_file
+#/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev,discard,inline_xattr                   wait,check,notrim,encryptable=/metadata/key_file
+/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev
                                                                                            wait,check,notrim,encryptable=/metadata/key_file
+/dev/block/platform/ff0f0000.dwmmc/by-name/userdata       /data               ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard,errors=panic   wait,check,encryptable=/metadata/key_file
 /dev/block/platform/ff0f0000.dwmmc/by-name/misc         /misc               emmc      defaults     defaults
 # /dev/block/platform/ff0f0000.dwmmc/by-name/radical_update /radical_update     ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard          wait
 
diff --git a/recovery.emmc.fstab b/recovery.emmc.fstab
old mode 100644
new mode 100755
index 572d70e..2981c59
--- a/recovery.emmc.fstab
+++ b/recovery.emmc.fstab
@@ -5,7 +5,7 @@
 /dev/block/platform/ff0f0000.dwmmc/by-name/system                /system              ext4             defaults                  defaults
 /dev/block/platform/ff0f0000.dwmmc/by-name/cache                 /cache               ext4             defaults                  defaults
 /dev/block/platform/ff0f0000.dwmmc/by-name/metadata              /metadata            ext4             defaults                  defaults
-/dev/block/platform/ff0f0000.dwmmc/by-name/userdata              /data                f2fs             defaults                  defaults
+/dev/block/platform/ff0f0000.dwmmc/by-name/userdata              /data                ext4             defaults                  defaults
 /dev/block/platform/ff0f0000.dwmmc/by-name/cust                  /cust                ext4             defaults                  defaults
 /dev/block/platform/ff0f0000.dwmmc/by-name/custom                /custom              ext4             defaults                  defaults
 /dev/block/platform/ff0f0000.dwmmc/by-name/radical_update        /radical_update      ext4             defaults                  defaults
@@ -18,4 +18,4 @@
 /dev/block/platform/ff0f0000.dwmmc/by-name/recovery              /recovery            emmc             defaults                  defaults
 /dev/block/platform/ff0f0000.dwmmc/by-name/backup                /backup              emmc             defaults                  defaults
 /dev/block/platform/ff0f0000.dwmmc/by-name/trust                 /trust               emmc             defaults                  defaults
-/dev/block/platform/ff0f0000.dwmmc/by-name/baseparamer           /baseparamer         emmc             defaults                  defaults
+/dev/block/platform/ff0f0000.dwmmc/by-name/baseparamer           /baseparamer         emmc             defaults                  defaults
\ No newline at end of file

device/rockchip/common:

diff --git a/device.mk b/device.mk
index 6f49c7e..3327a2f 100755
--- a/device.mk
+++ b/device.mk
@@ -73,7 +73,7 @@ PRODUCT_COPY_FILES += \
                
 
 # Filesystem management tools
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     mkfs_host.f2fs \
     fsck.f2fs \
     mkfs.f2fs \

 

Android8.1+rk3399:

/device/rockchip/common

diff --git a/device.mk b/device.mk
index 60005bd..e0913d0 100755
--- a/device.mk
+++ b/device.mk
@@ -58,7 +58,7 @@ PRODUCT_PROPERTY_OVERRIDES += \
     ro.rksdk.version=RK30_ANDROID$(PLATFORM_VERSION)-SDK-v1.00.00
 
 # Filesystem management tools
-PRODUCT_PACKAGES += \
+#PRODUCT_PACKAGES += \
     fsck.f2fs \
     mkfs.f2fs \
     fsck_f2fs

/device/rockchip/rk3399

diff --git a/device.mk b/device.mk
index 0390c64..97e6e50 100755
--- a/device.mk
+++ b/device.mk
@@ -25,13 +25,13 @@ PRODUCT_PACKAGES += \
     libion
 
 #enable this for support f2fs with data partion
-BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
+#BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
 
 # This ensures the needed build tools are available.
 # TODO: make non-linux builds happy with external/f2fs-tool; system/extras/f2fs_utils
-ifeq ($(HOST_OS),linux)
-  TARGET_USERIMAGES_USE_F2FS := true
-endif
+#ifeq ($(HOST_OS),linux)
+#  TARGET_USERIMAGES_USE_F2FS := true
+#endif
 
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/init.rk3399.rc:root/init.rk3399.rc \
diff --git a/recovery.fstab b/recovery.fstab
index ab69841..e923582 100755
--- a/recovery.fstab
+++ b/recovery.fstab
@@ -7,7 +7,7 @@
 /dev/block/by-name/oem                   /oem                 ext4             defaults                  defaults
 /dev/block/by-name/cache                 /cache               ext4             defaults                  defaults
 /dev/block/by-name/metadata              /metadata            ext4             defaults                  defaults
-/dev/block/by-name/userdata              /data                f2fs             defaults                  defaults
+/dev/block/by-name/userdata              /data                ext4             defaults                  defaults
 /dev/block/by-name/cust                  /cust                ext4             defaults                  defaults
 /dev/block/by-name/custom                /custom              ext4             defaults                  defaults
 /dev/block/by-name/radical_update        /radical_update      ext4             defaults                  defaults
diff --git a/rk3399_mid/fstab.rk30board b/rk3399_mid/fstab.rk30board
index b16e9de..5140639 100755
--- a/rk3399_mid/fstab.rk30board
+++ b/rk3399_mid/fstab.rk30board
@@ -14,4 +14,5 @@
 # For sdmmc
 /devices/platform/fe320000.dwmmc/mmc_host*        auto  auto    defaults        voldmanaged=sdcard1:auto,encryptable=userdata
 # Full disk encryption has less effect on rk3399, so default to enable this.
-/dev/block/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev,discard,inline_xattr                   wait,check,notrim,forceencrypt=/metadata/key_file
+#/dev/block/by-name/userdata       /data               f2fs      noatime,nodiratime,nosuid,nodev,discard,inline_xattr                   wait,check,notrim,forceencrypt=/metadata/key_file
+/dev/block/by-name/userdata       /data               ext4      noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard ,errors=panic                 wait,check,notrim,forceencrypt=/metadata/key_file
diff --git a/rk3399_mid/recovery.fstab b/rk3399_mid/recovery.fstab
index 26b8311..c0b3a08 100755
--- a/rk3399_mid/recovery.fstab
+++ b/rk3399_mid/recovery.fstab
@@ -7,7 +7,7 @@
 /dev/block/platform/fe330000.sdhci/by-name/oem                   /oem                 ext4             defaults                  defaults
 /dev/block/platform/fe330000.sdhci/by-name/cache                 /cache               ext4             defaults                  defaults
 /dev/block/platform/fe330000.sdhci/by-name/metadata              /metadata            ext4             defaults                  defaults
-/dev/block/platform/fe330000.sdhci/by-name/userdata              /data                f2fs             defaults                  defaults
+/dev/block/platform/fe330000.sdhci/by-name/userdata              /data                ext4             defaults                  defaults
 /dev/block/platform/fe330000.sdhci/by-name/cust                  /cust                ext4             defaults                  defaults
 /dev/block/platform/fe330000.sdhci/by-name/custom                /custom              ext4             defaults                  defaults
 /dev/block/platform/fe330000.sdhci/by-name/radical_update        /radical_update      ext4             defaults                  defaults

 

修改成功后,cat /proc/mounts可看出来:

 

 EXT4是Linux的标准文件系统,但相对与F2FS I/O读写速度较慢。

posted @ 2022-06-06 12:10  M-kobe  阅读(685)  评论(0编辑  收藏  举报