Bug#862822: setup-storage: Reinstallation using preserve_reinstall might fail with "Previous partitions overflow"

2017-09-14 Thread Thomas Lange
JFTR, this was added in commit 72b59db126ebf39.
Here's the comment in this commit:

   Align partition sizes to sectors or
   user-requested alignment on all disk labels, unless on DOS and preserving
   some partitions (stay with cylinder-alignment in those cases).


Currently I fear to change this code, since I'm not sure if the
exception for dos disk labels and when preserving a partition is
really needed or was just added com backward compability.

Or should we just change it and give it a try?
In which situtaions may we break things?
Please help me to decide if we should change this.
-- 
regards Thomas



Bug#862822: setup-storage: Reinstallation using preserve_reinstall might fail with "Previous partitions overflow"

2017-05-17 Thread Poenicke, Andreas (TFP)

Package: fai-setup-storage
Version: 4.3.1+deb8u1
Severity: normal
Tags: upstream

Dear Maintainer,

reinstalling a machine installed with the option "preserve_reinstall" seems
to be problematic. setup-storage usually fails with "Previous partitions
overflow begin of preserved partition" if the original partition was
created using the flag "flag_initial=1" and no "align-at"-option is
given in the configuration.

The reason seems to be an inconsistent calculation of the partition
sizes:

In Sizes.pm the function compute_partition_sizes checks if preserveparts
is set:
  
# align to cylinder boundary for msdos disklabels if at least one of

# the
# partitions has to be preserved, for backward compatibility
if ($FAI::configs{$config}{disklabel} eq "msdos" &&
  $FAI::configs{$config}{preserveparts} == 1) {
  $block_size = $current_disk->{sector_size} *
$current_disk->{bios_sectors_per_track} *
$current_disk->{bios_heads};

and sets the blocksize to the sector_size.
 
But if called with "flag_initial=1" this part is ignored. Giving a

blocksize of 512. Which in the end leads to partition layout
which usually doesn't match one with a blocksize=sector_size.

If manually enforcing an alignment with "align-at" this problem doesn't
occur due to

# but user-specified alignment wins no matter what
defined ($FAI::configs{$config}{align_at}) and
  $block_size = $FAI::configs{$config}{align_at};


Probably the blocksize should either be also set to sector_size if called with
"flag_initial=1", or setup-storage should acknowledge the existing layout
while calculating blocksize.

Regards,
Andreas Poenicke

-- System Information:
Debian Release: 8.8
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages fai-setup-storage depends on:
ii  liblinux-lvm-perl 0.17-2
ii  libparse-recdescent-perl  1.967009+dfsg-1
ii  parted3.2-7
ii  perl  5.20.2-3+deb8u6

Versions of packages fai-setup-storage recommends:
ii  lvm2   2.02.111-2.2+deb8u1
ii  mdadm  3.3.2-5+deb8u2

Versions of packages fai-setup-storage suggests:
pn  cryptsetup 
ii  dmsetup2:1.02.90-2.2+deb8u1
ii  dosfstools 3.0.27-1
pn  jfsutils   
ii  ntfs-3g1:2014.2.15AR.2-1+deb8u3
pn  reiserfsprogs  
pn  xfsprogs   

-- no debconf information