I've recently gotten into retro computing and found I need to create disk images. I also wanted to learn Go, so I figured I could kill two birds with one stone and create a tool for doing this, written in Go.
You'll notice that there are a lot of ancient disk formats here, and nothing more modern like extfs. This is deliberate; I need this for my retro computing projects, so a lot of this is of no interest to anyone except those in the retro community.
Why the name? Disk Go -> DiskGo -> Disko. Obviously.
Disko's Driver
type requires a file system implementation with a minimal
interface. For details on the functions that need to be implemented, see
DriverImplementation
in api.go
.
Symbols
- ✔: Supported
- ⚠: Partial implementation, see notes
- ✘: Doesn't make sense for this, so the function deliberately wasn't implemented.
Optional Features
Implementations of file systems may need to provide support for specific features. For convenience in the tables below, they are numbered thus:
- Directories
- File modes (Unix-style RWX)
- File ownership (Unix-style UID/GID)
- Timestamps
- Hard links
- Symbolic links
The base driver implements the following functions out of the box:
Function | Support | Required FS Features |
---|---|---|
Chdir | ✔ | 1 |
Chmod | ✔ | 2 |
Chown | ✔ | 3 |
Chtimes | ✔ | 4 |
Create | ✔ | |
Flush | ||
Getwd | ✔ | |
Lchown | ✔ | 3, 6 |
Link | ✔ | 5 |
Lstat | ✔ | |
Mkdir | ✔ | |
MkdirAll | ✔ | |
Open | ✔ | |
OpenFile | ✔ | |
ReadDir | ✔ | |
ReadFile | ✔ | |
Readlink | ✔ | |
Remove | ✔ | |
RemoveAll | ✔ | |
Rename | ||
SameFile | ✔ | |
Stat | ✔ | |
Symlink | 6 | |
Truncate | ✔ | |
Unmount | ||
Walk | ||
WriteFile | ✔ |
File handles support the following methods from os.File
:
Function | Support | Required FS Features |
---|---|---|
Chdir | ✔ | 1 |
Chmod | ✔ | 2 |
Chown | ✔ | 3 |
Close | ✔ | |
Fd | ✘ | |
Name | ✔ | |
Read | ✔ | |
ReadAt | ✔ | |
ReadDir | ✔ | 1 |
Readdir | ✔ | 1 |
Readdirnames | ✔ | 1 |
ReadFrom | ✔ | |
Seek | ✔ | |
SetDeadline | ✘ | |
SetReadDeadline | ✘ | |
SetWriteDeadline | ✘ | |
Stat | ✔ | |
Sync | ✔ | |
SyscallConn | ✘ | |
Truncate | ✔ | |
Write | ✔ | |
WriteAt | ✔ | |
WriteString | ✔ | |
WriteTo | ✔ |
The following table shows the file systems that drivers exist (or are planned) for, as well as the status of the capabilities.
File System | Introduced | Format New Image | Read | Write Existing Files | Create New Files | Delete Files |
---|---|---|---|---|---|---|
Unix v1 [1] | 1971 | ✔ | ||||
Unix v2 | 1972 | |||||
Unix v5 | 1973 | |||||
CP/M 1.4 | 1974 | |||||
Unix v6 | 1975 | |||||
FAT 8 | 1977 | ✔ | ||||
CP/M 2.2 | 1979 | |||||
Unix v7 | 1979 | |||||
FAT 12 | 1980 | |||||
CP/M 3.1 | 1983 | |||||
FAT 16 | 1984 | |||||
CP/M 4.1 [2] | 1985 | |||||
MINIX 3 [3] | 1987 | |||||
Unix v10 | 1989 | |||||
FAT 32 | 1996 | |||||
XV6 (maybe) | 2006 |
Legend:
- ✔: Full support
B
: Beta, largely stable, may contain bugsA
: Alpha, use at your peril
Feature | Status |
---|---|
Create blank image | |
List files | |
Insert individual files | |
Insert directory trees | |
Remove individual files | |
Remove using shell globs | |
Remove trees | |
Extract individual files | |
Extract directory trees | |
Extract using shell globs | |
Interactive editing |
I make the following guarantees:
- Versioning strictly follows the guidelines in Go's documentation.
- This is tested on:
- At least the latest three minor versions of Go, e.g. if 1.19.x is the most recent release, I guarantee I'll test this on 1.17, 1.18, and 1.19; 1.16 and earlier are best-effort.
- The latest versions of Ubuntu, Windows, and MacOS that are supported by GitHub.
- UNIX v1 File System
- Full UNIX v1 Manual, relevant parts pages 171-174.
- Full UNIX v2 Manual, relevant parts pages 221-224.
- Full UNIX v5 Manual, relevant parts pages 237-238.
- UNIX v6 File System
- UNIX v10 File System
- FAT 8, documenting FAT 8 on pages 172, 176, and 178.
- FAT 12/16/32 on Wikipedia
- CP/M file systems, including extensions.
- MINIX 3, shorter explanation here.
This is released under the terms of the AGPL v3 license (or later). Please see the LICENSE file in this repository for the legal text.
This project uses open-source software built by other people, who have my gratitude for building things so that I don't have to. [4]
[1] | Timestamps are stored according to the 1973 revision that uses the canonical Unix epoch. The first version of the specification can't represent timestamps past 1973-04-08 12:06:28.250. |
[2] | Also known as "DOS Plus". |
[3] | Note this is version 3 of the file system, not MINIX version 3. |
[4] | This should not be taken to imply that any of the people or organizations listed here endorse or are associated with this project. It's just a thank you. |