overwrite /etc/fstab and remove systemd-fsck units in tv-mbr-3parts.post 50/34350/2
authorSuchang Woo <suchang.woo@samsung.com>
Sat, 24 Jan 2015 09:32:34 +0000 (18:32 +0900)
committerJoonsub Lee <joon-sub.lee@samsung.com>
Mon, 26 Jan 2015 02:03:19 +0000 (18:03 -0800)
The default fs_passno value in /etc/fstab created by MIC tool is 0. If it is 0,
systemd-fstab-generator creates a mount unit without a dependency of fsck.
mounting a filesystem can be failed when fsck is running on that partition.

If fs_passno is set to non-zero (1 or 2), fsck will be automatically executed
before mounting, and systemd-fsck units will not be necessary.

Change-Id: Ia07b56aa469e2fa0d1d5f40585452097867a61d9
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
scripts/tv-mbr-3parts.post

index 9bf671a..3a9d851 100644 (file)
@@ -1,10 +1,23 @@
 #!/bin/sh
 echo "############### tv-mbr-3parts.post ################"
 
-cat >> /etc/fstab << EOF
+# overwrite /etc/fstab to execute fsck.
+#
+# The default value of the sixth field(fs_passno) in /etc/fstab
+# created by MIC tool is 0. If the value is 1 or 2, fsck will be executed
+# automatically before mounting. (refer to systemd-fstab-generator)
+cat > /etc/fstab << EOF
+# This file is generated by post script in .ks file.
+#
+# <file system> <mount point>   <type>  <options>        <dump> <pass>
+/dev/root       /               ext4    defaults,noatime 0      1
+devpts          /dev/pts        devpts  gid=5,mode=620   0      0
+tmpfs           /dev/shm        tmpfs   defaults         0      0
+proc            /proc           proc    defaults         0      0
+sysfs           /sys            sysfs   defaults         0      0
 
-LABEL=system-data /opt ext4  defaults,noatime 0 0
-LABEL=user /opt/usr  ext4    defaults,noatime 0 0
+LABEL=system-data /opt          ext4    defaults,noatime 0      2
+LABEL=user      /opt/usr        ext4    defaults,noatime 0      2
 EOF
 
 cat > /usr/lib/systemd/system/resize2fs@.service << EOF
@@ -25,10 +38,6 @@ TimeoutSec=0
 EOF
 
 mkdir -p /usr/lib/systemd/system/local-fs-pre.target.wants
-ln -s ../systemd-fsck@.service /usr/lib/systemd/system/local-fs-pre.target.wants/systemd-fsck@dev-disk-by\\x2dlabel-system\\x2ddata.service
-ln -s ../systemd-fsck@.service /usr/lib/systemd/system/local-fs-pre.target.wants/systemd-fsck@dev-disk-by\\x2dlabel-user.service
-ln -s ../systemd-fsck@.service /usr/lib/systemd/system/local-fs-pre.target.wants/systemd-fsck@dev-disk-by\\x2dlabel-rootfs.service
-
 ln -s ../resize2fs@.service /usr/lib/systemd/system/local-fs-pre.target.wants/resize2fs@dev-disk-by\\x2dlabel-system\\x2ddata.service
 ln -s ../resize2fs@.service /usr/lib/systemd/system/local-fs-pre.target.wants/resize2fs@dev-disk-by\\x2dlabel-user.service
 ln -s ../resize2fs@.service /usr/lib/systemd/system/local-fs-pre.target.wants/resize2fs@dev-disk-by\\x2dlabel-rootfs.service