Previous: set, Up: Command explanations


2.4.17 unit

— Command: unit unit

Selects the current default unit that Parted will use to display locations and capacities on the disk and to interpret those given by the user if they are not suffixed by an unit.

unit may be one of:

`s'
sector (n bytes depending on the sector size, often 512)
`B'
byte
`kB'
kilobyte (1000 bytes)
`MB'
megabyte (1000000 bytes)
`GB'
gigabyte (1000000000 bytes)
`TB'
terabyte (1000000000000 bytes)
`%'
percentage of the device (between 0 and 100)
`cyl'
cylinders (related to the BIOS CHS geometry)
`chs'
cylinders, heads, sectors addressing (related to the BIOS CHS geometry)
`compact'
This is a special unit that defaults to megabytes for input, and picks a unit that gives a compact human readable representation for output.

The default unit apply only for the output and when no unit is specified after an input number. Input numbers can be followed by an unit (without any space or other character between them), in which case this unit apply instead of the default unit for this particular number, but CHS and cylinder units are not supported as a suffix. If no suffix is given, then the default unit is assumed. Parted will compute sensible ranges for the locations you specify (e.g. a range of +/- 500 MB when you specify the location in “G”) and will select the nearest location in this range from the one you wrote that satisfies constraints from both the operation, the filesystem being worked on, the disk label, other partitions and so on. Use the sector unit “s” to specify exact locations (if they do not satisfy all onstraints, Parted will ask you for the nearest solution). Note that negative numbers count back from the end of the disk, with “-1s” pointing to the end of the disk.

Example:

          (parted) unit compact
          (parted) print
          Disk geometry for /dev/hda: 0kB - 123GB
          Disk label type: msdos
          Number  Start   End     Size    Type      File system  Flags
          1       32kB    1078MB  1077MB  primary   reiserfs     boot
          2       1078MB  2155MB  1078MB  primary   linux-swap
          3       2155MB  123GB   121GB   extended
          5       2155MB  7452MB  5297MB  logical   reiserfs
          (parted) unit chs print
          Disk geometry for /dev/hda: 0,0,0 - 14946,225,62
          BIOS cylinder,head,sector geometry: 14946,255,63.  Each cylinder
          is 8225kB.
          Disk label type: msdos
          Number  Start       End         Type      File system  Flags
          1       0,1,0       130,254,62  primary   reiserfs     boot
          2       131,0,0     261,254,62  primary   linux-swap
          3       262,0,0     14945,254,62 extended
          5       262,2,0     905,254,62  logical   reiserfs
          (parted) unit mb print
          Disk geometry for /dev/hda: 0MB - 122942MB
          Disk label type: msdos
          Number  Start   End     Size    Type      File system  Flags
          1       0MB     1078MB  1077MB  primary   reiserfs     boot
          2       1078MB  2155MB  1078MB  primary   linux-swap
          3       2155MB  122935MB 120780MB extended
          5       2155MB  7452MB  5297MB  logical   reiserfs