From 21be64fc6ef60a1e9dc7bc352131be58cc59d61d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 2 Jan 2013 12:52:14 +0100 Subject: [PATCH 49/89] doc: 1MiB-alignment is not enough for cheap flash drives * doc/parted.texi: Add an example that aligns to 4GiB, and reference Arnd Bergman's LWN article. --- doc/parted.texi | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/doc/parted.texi b/doc/parted.texi index b8db19d..008c383 100644 --- a/doc/parted.texi +++ b/doc/parted.texi @@ -14,7 +14,7 @@ and manipulating partition tables. @ifnottex @c texi2pdf don't understand copying and insertcopying ??? @c modifications must also be done in the titlepage @copying -Copyright @copyright{} 1999-2012 Free Software Foundation, Inc. +Copyright @copyright{} 1999-2013 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -577,15 +577,44 @@ partition table. @item ufs @end itemize -Example: +For example, the following creates a logical partition that will contain +an ext2 file system. The partition will start at the beginning of the disk, +and end 692.1 megabytes into the disk. @example (parted) @kbd{mkpart logical 0.0 692.1} @end example -Create a logical partition that will contain an ext2 file system. The -partition will start at the beginning of the disk, and end 692.1 -megabytes into the disk. +Now, we will show how to partition a low-end flash +device (``low-end'', as of 2011/2012). +For such devices, you should use 4MiB-aligned partitions@footnote{ +Cheap flash drives will be with us for a long time to +come, and, for them, 1MiB alignment is not enough. +Use at least 4MiB-aligned partitions. +For details, see Arnd Bergman's article, +@uref{http://http://lwn.net/Articles/428584/} and its many comments.}. +This command creates a tiny place-holder partition at the beginning, and +then uses all remaining space to create the partition you'll actually use: + +@example +$ @kbd{parted -s /dev/sdX -- mklabel msdos \} +@kbd{ mkpart primary fat32 64s 4MiB \} +@kbd{ mkpart primary fat32 4MiB -1s} +@end example + +Note the use of @samp{--}, to prevent the following @samp{-1s} last-sector +indicator from being interpreted as an invalid command-line option. +The above creates two empty partitions. The first is unaligned and tiny, +with length less than 4MiB. +The second partition starts precisely at the 4MiB mark +and extends to the end of the device. + +The next step is typically to create a file system in the second partition: + +@example +$ @kbd{mkfs.vfat /dev/sdX2} +@end example + @end deffn -- 1.8.5.3