[why] mkfs.btrfs "command not found" when os_mount=initramfs
[how] it will user mkfs.ext4. because mkfs.ext4 is common, other mkfs.*** is not considered
[how] mkfs.btrf and mkfs.ext4 is no exist, it will return
Signed-off-by: Hu XueJiao huxuejiao1@huawei.com --- lib/bootstrap.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index a7776d68..9744cb84 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -456,7 +456,12 @@ mount_rootfs() ROOTFS_DIR=/opt/rootfs mkdir -p $ROOTFS_DIR mount $rootfs_partition $ROOTFS_DIR || { - mkfs.btrfs -f $rootfs_partition + if has_cmd mkfs.btrfs; then + mkfs.btrfs -f $rootfs_partition + else + mkfs.ext4 -F $rootfs_partition || return + fi + mount $rootfs_partition $ROOTFS_DIR } mkdir -p $ROOTFS_DIR/tmp
On Thu, Oct 29, 2020 at 06:52:32PM +0800, Hu Xuejiao wrote:
[why] mkfs.btrfs "command not found" when os_mount=initramfs
[how] it will user mkfs.ext4. because mkfs.ext4 is common, other mkfs.*** is not considered
^ use or user?
[how] mkfs.btrf and mkfs.ext4 is no exist, it will return
Signed-off-by: Hu XueJiao huxuejiao1@huawei.com
lib/bootstrap.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index a7776d68..9744cb84 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -456,7 +456,12 @@ mount_rootfs() ROOTFS_DIR=/opt/rootfs mkdir -p $ROOTFS_DIR mount $rootfs_partition $ROOTFS_DIR || {
mkfs.btrfs -f $rootfs_partition
if has_cmd mkfs.btrfs; then
mkfs.btrfs -f $rootfs_partition
mkfs.btrfs -f $rootfs_partiton || return
else
mkfs.ext4 -F $rootfs_partition || return
fi
} mkdir -p $ROOTFS_DIR/tmpmount $rootfs_partition $ROOTFS_DIR
Thanks, Zhangyu