Creating a File-Backed Disk with mdconfig
$ dd if=/dev/zero of=newimage bs=1k count=5k 5120+0 records in 5120+0 records out $ mdconfig -a -t vnode -f newimage -u 0 $ bsdlabel -w md0 auto $ newfs md0a /dev/md0a: 5.0MB (10224 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 1.25MB, 80 blks, 192 inodes. super-block backups (for fsck -b #) at: 160, 2720, 5280, 7840 $ mount /dev/md0a /mnt $ df /mnt Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/md0a 4710 4 4330 0% /mnt ```sh …
Read more ⟶
Storing IP addresses in MySQL
Lets say you have the IP address 192.168.0.10 and want to store it in a table. The most common method people seem to use it to store it as a CHAR(15).
However, you probably want to search on this column and therefore want an index on it.
MySQL has two built-in functions, INET_ATON() which converts Internet addresses from the numbers-and-dots notation into a 32-bit unsigned integer, and INET_NTOA() which does the opposite.…
Read more ⟶