parted: mkpart
1
1 2.4.5 mkpart
1 ------------
1
1 -- Command: mkpart [PART-TYPE NAME FS-TYPE] START END
1
1 Creates a new partition, _without_ creating a new file system on
1 that partition. This is useful for creating partitions for file
1 systems (or LVM, etc.) that Parted doesn't support. You may
1 specify a file system type, to set the appropriate partition code
1 in the partition table for the new partition. FS-TYPE is required
1 for data partitions (i.e., non-extended partitions). START and END
1 are the offset from the beginning of the disk, that is, the
1 "distance" from the start of the disk.
1
1 PART-TYPE is one of 'primary', 'extended' or 'logical', and may be
1 specified only with 'msdos' or 'dvh' partition tables. A NAME must
1 be specified for a 'gpt' partition table. Neither PART-TYPE nor
1 NAME may be used with a 'sun' partition table.
1
1 FS-TYPE must be one of these supported file systems:
1 * ext2
1 * fat16, fat32
1 * hfs, hfs+, hfsx
1 * linux-swap
1 * NTFS
1 * reiserfs
1 * ufs
1 * btrfs
1
1 For example, the following creates a logical partition that will
1 contain an ext2 file system. The partition will start at the
1 beginning of the disk, and end 692.1 megabytes into the disk.
1
1 (parted) mkpart logical 0.0 692.1
1
1 Now, we will show how to partition a low-end flash device
1 ("low-end", as of 2011/2012). For such devices, you should use
1 4MiB-aligned partitions(1). This command creates a tiny
1 place-holder partition at the beginning, and then uses all
1 remaining space to create the partition you'll actually use:
1
1 $ parted -s /dev/sdX -- mklabel msdos \
1 mkpart primary fat32 64s 4MiB \
1 mkpart primary fat32 4MiB -1s
1
1 Note the use of '--', to prevent the following '-1s' last-sector
1 indicator from being interpreted as an invalid command-line option.
1 The above creates two empty partitions. The first is unaligned and
1 tiny, with length less than 4MiB. The second partition starts
1 precisely at the 4MiB mark and extends to the end of the device.
1
1 The next step is typically to create a file system in the second
1 partition:
1
1 $ mkfs.vfat /dev/sdX2
1
1 ---------- Footnotes ----------
1
1 (1) Cheap flash drives will be with us for a long time to come, and,
1 for them, 1MiB alignment is not enough. Use at least 4MiB-aligned
1 partitions. For details, see Arnd Bergman's article,
1 <http://http://lwn.net/Articles/428584/> and its many comments.
1