FULL COMMAND LIST FOR SECTORDISK.PW

This is available at the shell by running the help command.

Sector Editing/Reading/Etc

Sector and User Status

Other Useful Commands

Sector Graphics

File System

Sector Editing/Reading/Etc

se

SECTOR EDIT

Usage: se sector_number

Edit one of your owned sectors. Note that this will cache the sector to the hard disk before writing it to the floppy, so depending on disk activity it may take a moment for the sector to be available with sr.

Note that you can also edit your sectors with any other hex editor or editing program, and you can download/upload them using sftp with your shell login. For more information about the hexedit* program used on this system, run the command man hexedit.

Also note that any sector file larger than 512 bytes will be truncated. If you want to distribute a file across multiple sectors, see sdist.

SHORT HEXEDIT REFERENCE SHEET:

Ctrl-X        Prompt to save & quit
Ctrl-C        Quit without saving
Tab        Switch between Hex/ASCII
Ctrl-T        Truncate file to cursor
Enter        Goto Location (Hex)

sr

SECTOR READ

Usage: sr [-o] s1 [s2 ...]

This will read one or more sectors directly from the floppy disk (this is different from reading the cached sector files in your ~/sectors directory). This command uses dd to read the raw contents of the drive and hexdump to display it.

You can achieve the same effect by using the following command:

dd if=/floppy bs=512 count=1 skip=sector_number | hexdump -C

Options:

-o     Print to stdout instead of a pager

s0

ZERO SECTOR

Usage: s0 sector_number

This will zero out (delete all of the data) on one of your owned sectors. This action is not reversible, so if you want a backup of your sectors first, make one.

This is effectively the same as the command

dd if=/dev/zero of=/floppy bs=512 count=1 seek=sector_number

However, note that users do not have direct write access to the disk, so they must use the s0 command to zero out their cached sector files first before the changes are applied. (This is to prevent anyone from overwriting the entire disk).

If you really want to zero out more than one sector without confirmation, here are some examples on how to do so:

EXAMPLE ONE: Delete sectors x, y, and z:

for i in (x y z); do yes | s0 $i; done

EXAMPLE TWO: Delete sectors a-z:

for i in {a..z}; do yes | s0 $i; done

EXAMPLE THREE: Delete sectors a-c and x-z:

for i in {a..z} {x..z}; do yes | s0 $i; done

NOTE: Please DO NOT delete the files in your ~/sector directory! They are symbolic links to your owned sectors in /usr/local/share/sectors. If you DO end up deleting one by accident, run the command repop-sectors to repopulate your sector directory.

smov

SWAP SECTOR

Usage: smov sector_1 sector_2

Swap two owned sectors. If you would like to clear one of the sectors after the swap, use in combination with the s0 command.

If you want to copy one sector across multiple instead of swapping, use the scopy command.

scopy

SECTOR COPY

Usage: scopy s1 s2 [s3 ...]

This command allows you to copy the contents of one sector to one or more owned sectors. You can copy any sector so long as it is either claimed, non-empty, or both. (You cannot copy empty unclaimed sectors; use s0 for that).

If you want to simply swap sectors around, use smov.

sdist

SECTOR DISTRIBUTE

Usage: sdist input_file s1 [s2 ...]

Distribute a file across multiple sectors. This command is useful in the case that you have a file larger than one sector that you would like to place on the disk. It will be written in the order of the named sectors, so keep this in mind.

If the file is larger than the combined size of the named sectors, the program will ask you if you would like to truncate (short-stop) the file. Likewise, if it does not require all of the named sectors, the program will ask if you still want to overwrite all sectors (where empty space will be zeroed) or the minimum number required. Note that it is impossible to have zero data on a physical disk, so any leftover space will be filled with 00 hex.

(Beta note: I am planning on adding functionality to redownload a perfect copy of the original file by allowing users who own multiple sectors to have a definition sector for distributed files. There is no filesystem on the floppy disk).

Sector and User Status

available

AVAILABLE SECTORS

Usage: available [-o | -? | sector]

Lists all available sectors. If sector numbers are specified, tells you if those sectors are available or not.

Options:

-o      Print to stdout instead of a pager
-?      Get usage info
sector  Check if [sector] is available

For the sake of scripting, if one uses the [sector] parameter, the program will exit successfully (exit code 0) if the sector is available, and unsuccessfully (exit code 1) if it is not. (Keep in mind, exit code 1 is also used for general errors, but hopefully this will help somebody writing a script to see if multiple sectors are available or not).

A list of available sectors is available on the web here.

abandoned

ABANDONED SECTORS

Usage: abandoned

Lists sectors that have been abandoned by users.

Despite warnings by well-meaning oldsters that "things you put on the internet will never disappear", they sometimes do. After all, I, the sysadmin, could slam my finger into the eject button propelling the disk this system relies on out into the open air of my home. I could take a magnet to it, or if I'm feeling extreme, a degaussing device and wipe away every precious bit of data you've written to it, as I laugh maniacally, knowing good and well I've destroyed the 512-byte hopes and dreams of a thousand helpless souls.

But, I wouldn't do that. In fact, this command is evidence to my dedication to data-hoarding.

If a user's account gets terminated or for whatever reason sectors are given up, the content on them doesn't simply disappear. Oh no, no, no, dear user; this is the INTERNET where, as educational VHS's might tell you, nothing EVER goes away! Unless the content on the sector happens to be wildly inappropriate (let's say a particularly unethical password dump, a post meant to bully another user, or even--dare I say it, for the weak may faint and the strong become ill--a suggestion that NES games should be played in 16:9), it shall remain to be reclaimed. When another user ultimately reclaims it, they will inherit the content, with which they may do whatever they want.

Note that abandoned sectors with zero content (literally, all 0x00's), will be removed from the hard disk cache and simply appear as unclaimed. This is largely so that users can make use of this command (abandoned, if you've forgotten), to look through content that now belongs to no one.

If you want to read all abandoned sectors using just one command, you can do so like this:

abandoned | xargs sr

quota

USER DISK QUOTA

Usage: quota

Display user's maximum allowed disk space usage. (See man quota for detailed usage of this command. This is not a custom command, but it warrants some explanation here).

To ensure the VM doesn't totally run out of room (and to be sure that users don't just mass-upload files or upload ridiculously large files - after all, the whole floppy disk is just 1.44MB), user disk quotas are set on this system. This command will output something akin to the following:

Disk quotas for user fdiskquota (uid 1007):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sdb1       0   14400   14400               1       0       0

The important things here are the first 'blocks', 'quota', and 'limit' columns. The 'blocks' entry represents how many 1K blocks of storage you've used on the system. 'Quota' is the soft limit (in 1K blocks) of your disk usage (it'll give you a warning that you're out of space), and 'limit' is the hard limit (it'll mean it). The user directories under /home are on a different device than the cached sectors in /usr/local/share/sectors, so even if you owned all 2880 sectors on the disk, it shouldn't affect your intended user limit (although you might lose a couple of K to directory and filesystem information).

In the example above, the user is allowed 14400K (TEN floppy disks!) of storage. If, for whatever reason, the default isn't enough (say you've got some hefty user scripts or even just a good chunk of image files you want to turn into sectors), just message me (jebug29, the sysadmin, jebug29[at]sectordisk.pw), and ask about increasing your storage. I don't mind at all if one or two users want to use a bit more -- even double or triple -- just be mindful of the other users on the system and my own limited disk space! ;)

Other Useful Commands

repop-sectors

REPOPULATE SECTOR DIRECTORY

Usage: repop-sectors

This command repopulates the symbolic links in the user's sector directory. It simply checks for what files you have write access to in /usr/local/share/sectors and makes the links.

If you want to zero out the data in a sector, use the s0 command. DON'T delete the sector file.

commands

COMMAND LIST

Usage: commands

Gives a quick list of editing commands and their basic usage strings.

See help (aren't you already here?) for more commands and more detailed explanations about how they all work. COMMANDS DOES NOT CONTAIN EVERY SECTOR DISK-SPECIFIC COMMAND BUT HELP DOES!!

help

HELP

Usage: help [command]

Get a list of all commands along with detailed explanations about how each works and how to use them. Various usage examples are also available (i.e. how to zero out more than one sector (see help s0)).

A quick list of commands is also available with the commands command.

Sector Graphics

This tutorial may be more helpful for this section.

png2sector

PNG TO SECTOR

Usage: png2sector sector input_file.png

This allows you to apply the image data of a properly-paletted PNG file to an owned sector. (Technically it will work even if it isn't properly paletted, but that's no fun!)

You can reverse this process using the sector2png command, and you can view the image in a 256-color shell using the colors command!

See the tutorial here for more information and a better guide to creating your own raster sectors! There's also a video tutorial available if that would be more helpful to you.

sector2png

SECTOR TO PNG

Usage: sector2png sector output_file.png

Produces a paletted image file of the graphic representation of a given sector. You can preview what this will look like using the colors command.

colors

SECTOR COLORS

Usage: colors s1 [s2 ...]

Produces a visual representation directly in the terminal using the xterm color palette. It's cool!

File System

files

FILES

Usage: files [-? | user | sector [filename]]

This command will allow you to view files as defined in a file sector (more info below). There is currently no filesystem checking on the disk, so things like duplicate filenames and bad sector references will not be checked.

For users to have their file sectors be listed under their username, they must create a text file named '~/.filesector'. Sector numbers must be specified, separated by a newline ('\n'). Users must own their file sectors, although they do not have to own the sectors they reference in the file sector itself.

FLAGS

<none>     Get a list of users and their file sectors
-?         Help (also --help)
user       List files that user has defined
sector     List files defined in given sector
filename   Read the contents of the file to the shell.
           Must be used with 'sector' argument

FILE SECTOR FORMAT: File sectors begin with three bytes defining the disk number, the 16th byte where the first sector should begin, and the 16th byte where the last sector should end. Currently all three of these bytes are unused but for future compatibility purposes, they should be '\00\00\20'.

Afterwards, the location of data of the disk must be defined using track numbers (0-159) and the number of the sector (0-17) on that track in hexadecimal. Please note that this is NOT the same as the OVERALL sector number, which is what is used everywhere else. You can use the trackinfo command to get the sector and track numbers of a given sector and then hex to convert them to hexadecimal. Below is an example of finding sector 629 (sector 17 of track 34), where 0x22 is the track number and 0x11 is the sector number that would be used for the file sector.

jebug29@sectordisk:~$ trackinfo 629
Sector: 629
[ Head 0 | Cylinder 17 | Sector 17 of Track 34 ]

jebug29@sectordisk:~$ hex 34 17
22 11

The format for the location information is {track_number, sector number}, and the user is allowed to specify as many as they can fit into a given file definition and sector. For example, if I wanted to combine sectors 629 and 14 into one file, I would just add the track and sector info in series:

(Sector 629: track 0x22, sector 0x17), (Sector 14: track 0x00, sector 0x0E)

Location Information starts at byte 4:

Addr      Data (Hex)                                        Data (ASCII)
00000000  00 00 20 33 17 00 0e                              |.. 3...|

After the location information is complete, a filename may be provided. The filename will be decoded as UTF-8 and there is no character limit with the exception of that it must fit within the sector. The filename MUST end with \00\FF. This will end the string and close the file definition.

Addr      Data (Hex)                                        Data (ASCII)
00000000  00 00 20 33 17 00 0e 66  69 6c 65 6e 61 6d 65 2e  |.. 3...filename.|
00000010  65 78 74 00 ff                                    |ext..|

This completes a file definition.

For larger lengths of linear sectors, there is an alternative format for location data. It is {track number, '?' (0x3F), starting_sector, count}

For example, I currently have an image on the disk visualization that takes up 18 sectors, or a 6x3 block. It uses sectors 913-918, 1003-1008, and 1093-1098.

In the first format specified before ({track, sector}), each sector would need to be specified one by one, like so:

Addr      Data (Hex)                                        Data (ASCII)
00000000  00 00 20 32 0d 32 0e 32  0f 32 10 32 11 33 00 37  |.. 2.2.2.2.2.3.7|
00000010  0d 37 0e 37 0f 37 10 37  11 38 00 3c 0d 3c 0e 3c  |.7.7.7.7.8.<.<.<|
00000020  0f 3c 10 3c 11 3d 00 74  61 6e 61 6b 61 2d 6b 75  |.<.<.=.tanaka-ku|
00000030  6e 2e 62 69 6e 00 ff                              |n.bin..|

However, this could be far simplified using the second format, like so:

Addr      Data (Hex)                                        Data (ASCII)
00000000  00 00 20 32 3f 0d 06 37  3f 0d 06 3c 3f 0d 06 74  |.. 2?..7?..<?..t|
00000010  61 6e 61 6b 61 2d 6b 75  6e 2e 62 69 6e 00 ff     |anaka-kun.bin..|

This also saves 24 bytes worth of data.

Here is a breakdown of the above:

HEX            ASCII             DESCRIPTION
\00\00\20      ...               Disk 0, Start at 0000, End at 01FF
\32\3f\0d\06   2?..              Track 0x32, '?', Sector 0x0d, Read 6 sectors
                                    (sectors 913-918)
\37\3f\0d\06   7?..              Track 0x37, '?', Sector 0x0d, Read 6 sectors
                                    (sectors 1003-1008)
\3c\3f\0d\06   <?..              Track 0x3c, '?', Sector 0x0d, Read 6 sectors
                                    (sectors 1093-1098)
{}             tanaka-kun.bin    Filename: tanaka-kun.bin
\00\ff         ..                End string, end file descriptor

Quick Reference:

Bytes  Description
1      Disk number. For now should only be zero
1      Beginning byte [n], where [ n * 16 ] is the first byte of the data
1      Ending byte [n], where [ n * 16 - 1 ] is the last byte of the data
*      {Location Information}
       --Format One (Useful for scattered data):
          {track_number, sector_number} ...
          Example: File on sectors 14, 17, 400, 629
          Hex: 00 0E  00 11  16 04  22 11
       --Format Two (Useful for blocks of linear data):
          {track number, '?' (0x3F), starting_sector, count}
          Example: File on sectors 913-918, 1003-1008, 1093-1098
          Hex: 32 3F 0D 06  37 3F 0D 06  3C 3F 0D 06
*     Filename
1     0x00 End of String
1     0xFF End of Descriptor

SEE ALSO: trackinfo, hex, fileinfo, sdist

fileinfo

FILE INFORMATION

Usage: fileinfo definition_sector filename

Get information on a file specified in a definition sector. For help finding definition sectors and filenames, see the files command.

Gives user the total number of sectors, the disk number, the starting and ending locations, and all track and sector information.

SEE ALSO: files, trackinfo

trackinfo

TRACK INFORMATION

Usage: trackinfo sector_number

Gives head, cylinder, sector, and track information for a given sector in the following format:

[ Head N | Cylinder N | Sector X of Track Y ]

There are 18 512-byte sectors on every track of the disk. On a 1440K disk, there are a total of 2880 sectors and 159 tracks.

All numbers are zero indexed (i.e. head 0-1, cylinder 0-17, sector 0-17, track 0-159)

For more information, see Sectors and Tracks and Bytes (oh my!)

hex

BASE10 TO BASE16 CONVERTER

Usage: hex n0 [n1 n2 ...]

Converts Base-10 integers to hexadecimal numbers.

If an input isn't recognized, an asterisk (*) will be outputted.

Back to Top