Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

mkfs.ext4 in initrd #45

Open
gupta-ak opened this issue Jul 13, 2017 · 4 comments
Open

mkfs.ext4 in initrd #45

gupta-ak opened this issue Jul 13, 2017 · 4 comments

Comments

@gupta-ak
Copy link
Member

mkfs.ext4 in the initrd is a dynamically compiled binary that was taken from the ubuntu 16.04 distribution when we were initially testing. In the final product, we want a statically compiled mkfs.ext4 that we can verify the origin. There are two things we can investigate:

  • Busybox comes with mkfs.ext2. We can see if we can compile busybox to include mkfs.ext4.
  • Statically compile our own http://e2fsprogs.sourceforge.net/ which has ext4 support
@rn
Copy link
Contributor

rn commented Jul 13, 2017

for linuxkit we'd like to use Alpine's mkfs.ext4, ie:
docker run --rm -ti alpine:3.6 /bin/sh and then apk add --no-cache e2fsprogs man e2fsprogs-doc which gives you the binary as well as the man page. it seems to be incompatible in command line options to the one you used.

@gupta-ak
Copy link
Member Author

I tried the mkfs.ext4 for Alpine. Looks like Ubuntu's mkfs.ext4 is very lenient on the order of arguments, which is why it broke for Alpine. I should have a fix for it shortly.

However, when I try doing the mount -o loop <DEVICE> <DIR> command, I get a no space left error and my /dev/ directory has tens of thousands of loopback device. Any idea why?

I ran something like this:

root@ubuntu:~# docker run -ti alpine:3.6 /bin/sh
/ # apk add --no-cache e2fsprogs man e2fsprogs-doc
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/8) Installing libuuid (2.28.2-r2)
(2/8) Installing libblkid (2.28.2-r2)
(3/8) Installing libcom_err (1.43.4-r0)
(4/8) Installing e2fsprogs-libs (1.43.4-r0)
(5/8) Installing e2fsprogs (1.43.4-r0)
(6/8) Installing e2fsprogs-doc (1.43.4-r0)
(7/8) Installing mdocml (1.14.1-r0)
(8/8) Installing man (1.14.1-r0)
Executing busybox-1.26.2-r5.trigger
OK: 6 MiB in 19 packages
/ # dd if=/dev/zero of=/test-dev-blk bs=1M count=4
4+0 records in
4+0 records out
/ # mkfs.ext4 -O ^has_journal,^resize_inode, -N 512 -b 4096 -I 256 -F /test-dev-blk
mke2fs 1.43.4 (31-Jan-2017)
Discarding device blocks: done
Creating filesystem with 1024 4k blocks and 512 inodes

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

/ # mount -o loop /test-dev-blk /mnt
mount: can't setup loop device: No space left on device
/ # ls -1 /dev/ | grep loop | wc -l
251759

@gupta-ak
Copy link
Member Author

#49 Should fix the mkfs.ext4 part atleast

@rn
Copy link
Contributor

rn commented Jul 14, 2017

@gupta-ak Thanks. #49 indeed fixed the mkfs.ext4 issue I saw with Alpine's version of the tool

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants