Changeset 3550 in MondoRescue for branches


Ignore:
Timestamp:
Apr 4, 2016, 4:49:46 PM (8 years ago)
Author:
Bruno Cornec
Message:
  • Really fix #778 by taking in acount the FAT size !
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/MondoRescue/bin/mr-label

    r3522 r3550  
    121121my($inputfh, $buffer, $offset, $length, $hexlabel);
    122122
     123# Evaluate the size of the FAT with blkid -p
     124open(FS,"blkid -p $inputf|") || die "$0: cannot blkid -p $inputf: $!";
     125my $verfs = <FS>;
     126close(FS);
     127$verfs =~ s/.*VERSION="FAT([0-9][0-9]).*"/FAT$1/;
     128chomp($verfs);
     129pb_log(1,"Working on a FS ot type ***$verfs***\n");
     130
    123131open($inputfh,  "+< $inputf") || die "$0: cannot open $inputf for reading/writing: $!";
    124132binmode($inputfh) || die "binmode failed: $!";
    125133
     134# Source https://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html
    126135if (defined $label) {
    127     # 42 first bytes are untouched
    128     $offset = 43;
     136    # x first bytes are untouched
     137    $offset = 43 if (($verfs =~ /FAT16/) || ($verfs =~ /FAT12/));
     138    $offset = 71 if ($verfs =~ /FAT32/);
    129139    $length = 11;
    130140} elsif (defined $uuid) {
    131     # 38 first bytes are untouched
    132     $offset = 39;
     141    # x first bytes are untouched
     142    $offset = 39 if (($verfs =~ /FAT16/) || ($verfs =~ /FAT12/));
     143    $offset = 67 if ($verfs =~ /FAT32/);
    133144    $length = 4;
    134145} else {
Note: See TracChangeset for help on using the changeset viewer.