microsoft / opengcs

Moved to https://github.com/microsoft/hcsshim/tree/master/internal/guest. If you wish to open PRs/submit issues please do so against https://github.com/microsoft/hcsshim.
MIT License
83 stars 41 forks source link

mkfs.ext4 in initrd #45

Open gupta-ak opened 7 years ago

gupta-ak commented 7 years ago

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:

rn commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

49 Should fix the mkfs.ext4 part atleast

rn commented 7 years ago

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