mkimg(1) creates a file in TMPDIR until no space left
Matthias Apitz
guru at unixarea.de
Sat Sep 29 17:34:34 UTC 2018
Hello,
I'm using a copy of src/release/amd64/make-memstick.sh to build from a
complete root in /usr/local/r338641/root.r338641 (result of make
installworld and installkernel to this dir) for testing purpose a memstick
image and write this with dd(1) to an USB key of ~32 GByte. I'm using a
copy of this script because I want to define the size of the UFS in the
image to have there enough free space to install later after boot as
well packages to test them.
The modification is only setting '-M 50331648b -m 50331648b' for the file
system created with mkfs(8). Here is what is running exactly:
# TMPDIR=/usr/tmp export TMPDIR
# ./make-memstick.sh /usr/local/r338641/root.r338641 /usr/local/r338641/memstick.im
+ makefs -B little -M 50331648b -m 50331648b -o 'label=FreeBSD_Install' -o 'version=2' /usr/local/r338641/memstick.im.part /usr/local/r338641/root.r338641
Calculated size of `/usr/local/r338641/memstick.im.part': 25769803776 bytes, 24530 inodes
Extent size set to 32768
/usr/local/r338641/memstick.im.part: 24576.0MB (50331648 sectors) block size 32768, fragment size 4096
using 28 cylinder groups of 901.44MB, 28846 blks, 1024 inodes.
super-block backups (for fsck -b #) at:
192, 1846336, 3692480, 5538624, 7384768, 9230912, 11077056,
12923200, 14769344, 16615488, 18461632, 20307776, 22153920, 24000064,
25846208, 27692352, 29538496, 31384640, 33230784, 35076928, 36923072,
38769216, 40615360, 42461504, 44307648, 46153792, 47999936, 49846080,
Populating `/usr/local/r338641/memstick.im.part'
Image `/usr/local/r338641/memstick.im.part' complete
+ rm /usr/local/r338641/root.r338641/etc/fstab
+ rm /usr/local/r338641/root.r338641/etc/rc.conf.local
+ mkimg -C 28G -s mbr -b /usr/local/r338641/root.r338641/boot/mbr -p 'efi:=/usr/local/r338641/root.r338641/boot/boot1.efifat' -p 'freebsd:-mkimg -C 28G -s bsd -b /usr/local/r338641/root.r338641/boot/boot -p freebsd-ufs:=/usr/local/r338641/memstick.im.part' -a 2 -o /usr/local/r338641/memstick.im
...
While the cascade of mkimg(1) is running a *big* temp file is created,
which at the end eats up all memory of the disk:
# ls -lh /usr/local/r338641 /usr/tmp
/usr/local/r338641:
total 25172008
-rwxr-xr-x 1 root wheel 1.3K Sep 29 16:41 make-memstick.sh
-rw-r--r-- 1 root wheel 0B Sep 29 16:50 memstick.im
-rw-r--r-- 1 root wheel 24G Sep 29 16:50 memstick.im.part
drwxr-xr-x 18 root wheel 512B Sep 24 07:11 root.r338641
/usr/tmp:
total 11307168
-rw------- 1 root wheel 456G Sep 29 17:01 mkimg-LmntlL <<<******** 456G !!!
-rw------- 1 root wheel 0B Sep 29 16:50 mkimg-yfU8Lr
/: write failed, filesystem is full
/: write failed, filesystem is full
But the 'memstick.im' is created fine at the end:
# ls -lh /usr/local/r338641 /usr/tmp
/usr/local/r338641:
total 2591752
-rwxr-xr-x 1 root wheel 1.3K Sep 29 16:41 make-memstick.sh
-rw-r--r-- 1 root wheel 24G Sep 29 17:22 memstick.im
drwxr-xr-x 18 root wheel 512B Sep 24 07:11 root.r338641
/usr/tmp:
total 0
And the UBS stick produced from 'memstick.im' with dd(1) boots fine and the root
file system has around 20 GB free space.
Why it is mkimg(1) creating such a big temp. file?
matthias
--
Matthias Apitz, ✉ guru at unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
More information about the freebsd-current
mailing list