Safe Haskell | None |
---|---|
Language | Haskell2010 |
Propellor.Property.Parted
Synopsis
- data TableType
- data PartTable = PartTable TableType Alignment [Partition]
- partTableSize :: PartTable -> ByteSize
- data Partition = Partition {}
- mkPartition :: Maybe Fs -> PartSize -> Partition
- data Fs
- data PartSize
- type ByteSize = Integer
- toPartSize :: ByteSize -> PartSize
- fromPartSize :: PartSize -> ByteSize
- reducePartSize :: PartSize -> PartSize -> PartSize
- newtype Alignment = Alignment ByteSize
- safeAlignment :: Alignment
- type MkfsOpts = [String]
- data PartType
- data PartFlag
- partitioned :: Eep -> FilePath -> PartTable -> Property DebianLike
- parted :: Eep -> FilePath -> [String] -> Property (DebianLike + ArchLinux)
- data Eep = YesReallyDeleteDiskContents
- installed :: Property (DebianLike + ArchLinux)
- calcPartTable :: DiskSize -> TableType -> Alignment -> [PartSpec DiskPart] -> PartTable
- newtype DiskSize = DiskSize ByteSize
- data DiskPart
- data DiskSpaceUse
- useDiskSpace :: PartSpec DiskPart -> DiskSpaceUse -> PartSpec DiskPart
- defSz :: PartSize
- fudgeSz :: PartSize -> PartSize
Types
Types of partition tables supported by parted.
Instances
A disk's partition table.
partTableSize :: PartTable -> ByteSize Source #
Gets the total size of the disk specified by the partition table.
A partition on the disk.
Constructors
Partition | |
mkPartition :: Maybe Fs -> PartSize -> Partition Source #
Makes a Partition with defaults for non-important values.
Filesystems etc that can be used for a partition.
Size of a partition.
toPartSize :: ByteSize -> PartSize Source #
Rounds up to the nearest MegaByte.
fromPartSize :: PartSize -> ByteSize Source #
Partitions need to be aligned for optimal efficiency. The alignment is a number of bytes.
Instances
Eq Alignment Source # | |
Ord Alignment Source # | |
Show Alignment Source # | |
safeAlignment :: Alignment Source #
4MiB alignment is optimal for inexpensive flash drives and is a good safe default for all drives.
type MkfsOpts = [String] Source #
Options passed to a mkfs.* command when making a filesystem.
Eg, ["-m0"]
Type of a partition.
Flags that can be set on a partition.
Properties
partitioned :: Eep -> FilePath -> PartTable -> Property DebianLike Source #
Partitions a disk using parted, and formats the partitions.
The FilePath can be a block device (eg, /dev/sda), or a disk image file.
This deletes any existing partitions in the disk! Use with EXTREME caution!
parted :: Eep -> FilePath -> [String] -> Property (DebianLike + ArchLinux) Source #
Runs parted on a disk with the specified parameters.
Parted is run in script mode, so it will never prompt for input.
Constructors
YesReallyDeleteDiskContents |
Partition table sizing
calcPartTable :: DiskSize -> TableType -> Alignment -> [PartSpec DiskPart] -> PartTable Source #
Calculate a partition table, for a given size of disk.
For example:
calcPartTable (DiskSize (1024 * 1024 * 1024 * 100)) MSDOS safeAlignment [ partition EXT2 `mountedAt` "/boot" `setSize` MegaBytes 256 `setFlag` BootFlag , partition EXT4 `mountedAt` "/" `useDiskSpace` RemainingSpace ]
Size of a disk, in bytes.
data DiskSpaceUse Source #
Constructors
Percent Int | |
RemainingSpace |
useDiskSpace :: PartSpec DiskPart -> DiskSpaceUse -> PartSpec DiskPart Source #
Make a partition use some percentage of the size of the disk (less all fixed size partitions), or the remaining space in the disk.
fudgeSz :: PartSize -> PartSize Source #
When a partition is sized to fit the files that live in it, this fudge factor is added to the size of the files. This is necessary since filesystems have some space overhead.
Add 2% for filesystem overhead. Rationalle for picking 2%: A filesystem with 1% overhead might just sneak by as acceptable. Double that just in case. Add an additional 3 mb to deal with non-scaling overhead of filesystems (eg, superblocks). Add an additional 200 mb for temp files, journals, etc.