Generic Bootstrap Blog

(Serial No. 02fb0b13175bd913)

Creative Commons License

Quick note: 'Block device required' when trying to mount() after mknod()

 » 2016-03-25 07:09:56 | git log | tags: quick-note

This is something that had me stuck for days on an upcoming project. If you’re experiencing bizarre results with nodes you’ve created yourself, make sure you’ve sprinkled S_IFBLK into your mode_t bitfield. Your node won’t function as one without it. See Busybox’s mdev.c:

int major, minor, type;
int mode = 0660;
...
type = path[5]=='c' ? S_IFCHR : S_IFBLK;
...
mknod(device_name, mode | type, makedev(major, minor))