Changeset 3647 in MondoRescue for branches/3.3


Ignore:
Timestamp:
Jan 13, 2017, 5:35:12 PM (7 years ago)
Author:
Bruno Cornec
Message:
  • Fix #805 by forcing the usage of parted when more than 1000 disks are reported by fdisk
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi/mr-parted2fdisk

    r3631 r3647  
    170170}
    171171
    172 # Create a device var which will be the devide or partition on which to work
     172# Create a device var which will be the device or partition on which to work
    173173# whatever the option used.
    174174$device = $ARGV[0] if (defined $opts{'l'});
     
    243243$min =~ s/[a-z]+// if (defined $min);
    244244
     245# fdisk has a bug when handling more than 1024 disks, seen on RHEL
     246# so in that case we want to use parted instead
     247# # Cf: http://trac.mondorescue.org/ticket/805
     248my $use_parted = 0;
     249open(CMD,"LANGUAGE=C $fdisk -l |") || die "Unable to execute $fdisk";
     250my $lines = 0;
     251while (<CMD>) {
     252    $lines++ if ($_ =~ /^Disk \//);
     253}
     254close(CMD);
     255# More than 1000 is a lot of disks so may triggers the issue
     256$use_parted = 1 if ($lines >= 1000);
     257
    245258# Check partition table type
    246259$type = mr_disk_type($device);
    247260# Replacement code only for GPT disks
    248 if ((($v == 1) || (($v == 2) && ($maj < 22))) && ($type ne "MBR")) {
     261if (((($v == 1) || (($v == 2) && ($maj < 22))) && ($type ne "MBR")) || ($use_parted == 1)) {
    249262    pb_log(1,"This distribution uses an old fdisk, activating replacement code for GPT disk label...\n");
    250263    my $parted = pb_check_req("parted",0);
Note: See TracChangeset for help on using the changeset viewer.