NAME
disksim – disk simulator

SYNOPSIS
aux/disksim [ –r ] [ –f file ] [ –s srvname ] [ –m mtpt ] [ diskname ]

DESCRIPTION
Disksim presents an in–memory disk in the manner of the sd(3) device on mtpt/diskname (default /dev/sdXX). The disk is initialized to zeros; non–zeroed blocks written to the disk are kept in memory.

When setting disk geometry with the geometry control message, the arguments are sectors, sector size, cylinders, heads, and sectors per track. The last three may be zero for LBA disk simulations, but must be present.

The –f option causes disksim to use file as the initial contents of the disk rather than a zeroed image. Changes made to the disk are written back to file unless the –r option is given.

The –s option causes disksim to post its 9P service at /srv/service.

EXAMPLES
Disksim can be used to test programs such as fdisk and prep(8) that expect sd(3) disks:
aux/disksim
echo geometry 40000 512 0 0 0 >/dev/sdXX/ctl # 20MB
disk/mbr /dev/sdXX/data
disk/fdisk –baw /dev/sdXX/data
disk/prep /dev/sdXX/plan9

Disksim is useful for creating very large but mostly zeroed files for testing other programs. Test tar(1)'s handling of large files:
for(i in sdXX sdYY sdZZ) aux/disksim $i
echo geometry 40000000 512 0 0 0 >/dev/sdXX/ctl # 20GB
echo geometry 10000000 512 0 0 0 >/dev/sdYY/ctl # 5GB
echo geometry 20000000 512 0 0 0 >/dev/sdZZ/ctl # 10GB
tar cf /dev/sdXX/data /dev/sdYY/data /dev/sdZZ/data
tar tvf /dev/sdXX/data

SOURCE
/sys/src/cmd/aux/disksim.c

SEE ALSO
sd(3), prep(8)
Copyright © 2024 Alcatel-Lucent. All rights reserved.