Sortix
Sortix Download Manual Development Source Code News Blog More
current nightly

Sortix cross-nightly manual

This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.

NAME

disked — disk editor

SYNOPSIS

disked [-in] [--fstab=path] [device] [command ...]

DESCRIPTION

disked is an interactive program that manages partition tables. It can create and destroy partition tables on block devices. It can create partitions and destroy them. It can format filesystems on partitions and configure mountpoints in fstab(5). disked supports the Master Boot Record and GUID Partition Table partitioning schemes.
disked provides an interactive command line. Its prompt shows the currently selected device (defaulting to the first writable device alphabetically if any) or (disked) if none is selected. If a command is specified on the command line, then that command is run with its arguments non-interactively instead of reading from the standard input.
Commands perform their actions when run rather than waiting for the user to write out changes. disked only creates partitions aligned to 1 MiB boundaries whose size is a multiple of 1 MiB. Unused regions are aligned and those smaller than the alignment are not shown. The options are as follows:
--fstab=path
Use path instead of /etc/fstab as fstab(5).
-i
Run in interactive mode with prompt with line editing. Commands will ask for missing parameters. This is the default if the standard input and output are terminals and a command is not specified on the command line.
-n
Run in non-interactive mode reading commands from the standard input. Commands will not ask for missing parameters and disked will immediately exit unsuccessfully if any command fail.
The following commands are supported:
device device-index
Switch to the device device-index as numbered by the devices command. If no index is specified, show the name of the current device. Alternatively you can write the absolute path to the device such as /dev/ahci0 or just its name ahci0.
devices
List every available block device and show their indexes, device names (as found in /dev), model names and serial numbers. Devices are counted from 0.
exit
Exit disked.
fsck partition-index
Perform a fsck(8) filesystem check of the partition partition-index on the current device.
help
List available commands.
id partition-index
List the identifiers for the filesystem on the partition partition-index on the current device. These identifiers are key-values separated by an equals character, suitable for use in the fstab(5) fs_spec field to locate filesystems.
ls
Display the partition table of the current device. Partitions are counted from 1.
man [...]
Display this manual page if no operands are given, otherwise run man(1) with the given command line.
mkpart hole offset length filesystem mountpoint options
Create a partition on the current device. If the partition table has multiple unused regions (holes), disked asks you which hole (counting from 1) to use. You need to specify the offset into the hole where the partition is created and then the length of the partition. See QUANTITIES below on the possible partition offset and length values. You will be asked if you want to format a filesystem:
biosdata
(gpt only) Format a BIOS boot partition, which is required for booting with GRUB from a root filesystem on a GPT partition. 1 MiB is sufficient for this kind of partition.
extended
(mbr only) Create an extended partition, which can contain an arbitrary amount logical partitions. You can only have a single extended partition.
ext2
Format an ext2 filesystem.
no
Use the existing disk data.
If you format a mountable filesystem, then you will be asked if you want to create a mountpoint for the partition, which will be added to fstab(5). If a mountpoint is created, then you will be asked for the comma-separated mount options for the filesystem, which are typically rw for read-write access, ro for read-only access, cache=N% to set the cache size to N percent of system memory, or other filesystem specific values.
mktable [mbr | gpt]
Create a partition table on the current device of the specified type.
mount partition-index [mountpoint | no] options
Mount the partition partition-index of the current device on mountpoint with the mount options in fstab(5), or if no then remove any existing mountpoints. Conflicting mountpoints are removed.
quit
Exit disked.
rmpart partition-index
Delete the partition partition-index on the current device. The partition data is rendered inaccessible but is not actually erased. The partition can technically be recovered using mkpart. The partition data no longer has the protections of being in a partition and looks like regular unused space and can easily be overwritten. You should not delete a partition unless you want its contents gone. Deleting an extended partition deletes all the partitions it contains.
rmtable
Delete the partition table on the current device. The existing partitions are rendered inaccessible but are not actually erased. The partitions can technically be recovered using mktable and mkpart. The disk data no longer has the protections of being partitioned and looks like regular unused space and can easily be overwritten. You should not delete the partition table unless you want all the data on the disk gone.
sh
Run an interactive shell.

QUANTITIES

disked allows useful expressions when describing disk offsets and lengths. Every question needs an answer between 0 and a maximum. You can answer in percent where 100% is the maximum. You can answer an integer value followed by a suffix such as B, K, M, G, T, or P to signify bytes, KiB, MiB, GiB, TiB, and PiB respectively. The value is in MiB by default if there is no suffix. The answer is rounded to the 1 MiB alignment. If the expression is a negative value, then the answer is the maximum minus the absolute value. For instance:
42%
Use 42% of the maximum.
13m
Use 13 MiB.
37
Use 37 MiB.
9001 GiB
Use 9001 GiB.
-100M
Leave 100 MiB at the end.
-10%
Use 90% of the maximum.

FILES

/etc/fstab
filesystem table (see fstab(5))

EXAMPLES

(ahci0) devices         # list devices 
(ahci0) device 1        # select device 1 
(ahci1) mktable gpt     # create partition table 
(ahci1) mkpart          # create partition 
0%                      # no free space preceding it 
50%                     # use half the disk 
ext2                    # format an ext2 filesystem 
/home/user              # use as /home/user filesystem 
rw,cache=2%             # read-write, use 2% of memory as cache 
(ahci1) ls              # inspect partition table 
(ahci1) mount 1 /home   # change partition 1 mountpoint to /home 
(ahci1) exit            # done

SEE ALSO

fstab(5), gpt(7), mbr(7), extfs(8), fsck(8), init(8), iso9660fs(8)
Copyright 2011-2025 Jonas 'Sortie' Termansen and contributors.
Sortix's source code is free software under the ISC license.
#sortix on irc.sortix.org
@sortix_org