1
0

disksim 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. .TH DISKSIM 8
  2. .SH NAME
  3. disksim \- disk simulator
  4. .SH SYNOPSIS
  5. .B aux/disksim
  6. [
  7. .B -r
  8. ]
  9. [
  10. .B -f
  11. .I file
  12. ]
  13. [
  14. .B -s
  15. .I srvname
  16. ]
  17. [
  18. .B -m
  19. .I mtpt
  20. ]
  21. [
  22. .I diskname
  23. ]
  24. .SH DESCRIPTION
  25. .I Disksim
  26. presents an in-memory disk in the manner of the
  27. .IR sd (3)
  28. device on
  29. .IB mtpt / diskname
  30. (default
  31. .BR /dev/sdXX ).
  32. The disk is initialized to zeros;
  33. non-zeroed blocks written to the disk are kept in memory.
  34. .PP
  35. When setting disk geometry with the
  36. .B geometry
  37. control message,
  38. the arguments are
  39. sectors, sector size, cylinders, heads, and sectors per track.
  40. The last three may be zero for LBA disk simulations,
  41. but must be present.
  42. .PP
  43. The
  44. .B -f
  45. option causes
  46. .I disksim
  47. to use
  48. .I file
  49. as the initial contents of the disk rather than a zeroed image.
  50. Changes made to the disk are written back to
  51. .I file
  52. unless the
  53. .B -r
  54. option is given.
  55. .PP
  56. The
  57. .B -s
  58. option causes
  59. .I disksim
  60. to post its 9P service at
  61. .BI /srv/ service \fR.
  62. .SH EXAMPLES
  63. .I Disksim
  64. can be used to test programs such as
  65. .I fdisk
  66. and
  67. .IR prep (8)
  68. that expect
  69. .IR sd (3)
  70. disks:
  71. .IP
  72. .EX
  73. aux/disksim
  74. echo geometry 40000 512 0 0 0 >/dev/sdXX/ctl # 20MB
  75. disk/mbr /dev/sdXX/data
  76. disk/fdisk -baw /dev/sdXX/data
  77. disk/prep /dev/sdXX/plan9
  78. .EE
  79. .PP
  80. .I Disksim
  81. is useful for creating very large but mostly zeroed files
  82. for testing other programs.
  83. Test
  84. .IR tar (1)'s
  85. handling of large files:
  86. .IP
  87. .EX
  88. for(i in sdXX sdYY sdZZ) aux/disksim $i
  89. echo geometry 40000000 512 0 0 0 >/dev/sdXX/ctl # 20GB
  90. echo geometry 10000000 512 0 0 0 >/dev/sdYY/ctl # 5GB
  91. echo geometry 20000000 512 0 0 0 >/dev/sdZZ/ctl # 10GB
  92. tar cf /dev/sdXX/data /dev/sdYY/data /dev/sdZZ/data
  93. tar tvf /dev/sdXX/data
  94. .EE
  95. .SH SOURCE
  96. .B /sys/src/cmd/aux/disksim.c
  97. .SH SEE ALSO
  98. .IR sd (3),
  99. .IR prep (8)