MinFS is a simple, unix-like filesystem built for Zircon.
It currently supports files up to 4 GB in size.
# (Linux) $ truncate --size=16G blk.bin # (Mac) $ mkfile -n 16g blk.bin
fx set bringup.x64 fx build fx run -- -hda blk.bin
Warning: On real hardware, /dev/class/block/...
refers to REAL storage devices (USBs, SSDs, etc).
BE CAREFUL NOT TO FORMAT THE WRONG DEVICE. If in doubt, only run the following commands through QEMU. The lsblk
command can be used to see more information about the devices accessible from Zircon.
lsblk
can be used to list the block devices currently on the system. On this example system below, /dev/class/block/000
is a raw block device.> lsblk ID DEV DRV SIZE TYPE LABEL 000 block block 16G
> gpt init /dev/class/block/000 ... > lsblk ID DEV DRV SIZE TYPE LABEL 002 block block 16G
lsblk
to keep track of how to refer to the block device).> gpt dump /dev/class/block/002 blocksize=512 blocks=33554432 Partition table is valid GPT contains usable blocks from 34 to 33554398 (inclusive) Total: 0 partitions
gpt dump
tells us some important info: it tells us (1) How big blocks are, and (2) which blocks we can actually use. Let's fill part of the disk with a MinFS filesystem.> gpt add 34 20000000 minfs /dev/class/block/002
lsblk
you should see a block device which is the whole disk and a slightly smaller device which is the partition. In the above output, the partition is device 003, and would have the path /dev/class/block/003
> mkfs <PARTITION_PATH> minfs
lsblk
again to locate the entry for the disk. We want to edit the type of the zero-th partition. Here we use the keyword ‘DATA’ to set the type GUID, but if you wanted to use an arbitrary GUID you would supply it where ‘DATA’ is used.> gpt edit 0 type DATA <DEVICE_PATH>
On any future boots, the partition will be mounted automatically at /data
.
If you don't want the partition to be mounted automatically, you can update the visibility (or GUID) of the partition, and simply mount it manually.
> mount <PARTITION_PATH> /data
/data
(the mount point for this GUID) will persist across boots. To test this, try making a file on the new MinFS volume, rebooting, and observing it still exists.> touch /data/foobar > dm reboot > ls /data
> df <PATH>