[Parted-maintainers] Bug#902224: parted: bogus rounding of exact sizes

Adam Borowski kilobyte at angband.pl
Sat Jun 23 16:12:32 BST 2018


Package: parted
Version: 3.2-21+b1
Severity: normal

In the following session:

GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit mib                                                         
(parted) rm 1                                                             
(parted) mkpart                                                           
Partition type?  primary/extended? p                                      
File system type?  [ext2]?                                                
Start? 1mib                                                               
End? 100mib                                                               
(parted) mkpart                                                           
Partition type?  primary/extended? p                                      
File system type?  [ext2]? f2fs                                           
parted: invalid token: f2fs
File system type?  [ext2]?                                                
Start? 100mib                                                             
End? 100%                                                                 
Warning: You requested a partition from 100MiB to 14772MiB (sectors
204800..30253055).
The closest location we can manage is 100MiB to 14772MiB (sectors
204801..30253055).
Is this still acceptable to you?
Yes/No? y                                                                 
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? c                                                          
(parted) rm 1                                                             
(parted) mkpart
Partition type?  primary/extended? p                                      
File system type?  [ext2]?                                                
Start? 1mib                                                               
End? 102400kib                                                            
(parted) mkpart                                                           
Partition type?  primary/extended? p                                      
File system type?  [ext2]?                                                
Start? 102400kib                                                          
End? 100%                                                                 
(parted) q

I specified an exact, very nicely aligned, value of 100MB (which parted
wants spelled as "mi"llion "b"its...).  Yet it somehow got rounded into
something 512 bytes bigger -- not rounded to a KB nor even MB.  It went
right only when I wrote that 100MB as "102400kib" rather than "100mib"
as in the first try.

Thus:
1. values in exact units such as MB ("mib") must not get rounded
2. if you round, you should do so to a number that's aligned to common
   erase block sizes


Meow!
-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: arm64 (aarch64)

Kernel: Linux 4.17.2-00173-g5dedaf7ec1ed (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages parted depends on:
ii  libc6         2.27-3
ii  libparted2    3.2-21+b1
ii  libreadline7  7.0-5
ii  libtinfo6     6.1+20180210-4

parted recommends no packages.

Versions of packages parted suggests:
pn  parted-doc  <none>

-- no debconf information



More information about the Parted-maintainers mailing list