Public bug reported:

When using ubuntu-recovery to recover the system, 
The partition layout is different when keeping home partition.

consider disk-recipe:

 100 150 200 free
        $iflabel{ gpt }
        $reusemethod{ }
        method{ efi }
        format{ } .

128 512 256 ext2
        $defaultignore{ }
        method{ format }
        format{ }
        use_filesystem{ }
        filesystem{ ext2 }
        mountpoint{ /boot } .

32000 10000 32000 $default_filesystem
        $lvmok{ }
        method{ format }
        format{ }
        use_filesystem{ }
        reserved_for_root{ 1 }
        $default_filesystem{ }
        mountpoint{ / } .

8000 512 8000 linux-swap
        $lvmok{ }
        method{ swap }
        format{ } .

500 10000 -1 $default_filesystem
        $lvmok{ }
        $reusemethod{ }
        method{ format }
        format{ }
        use_filesystem{ }
        $default_filesystem{ }
        label{ User_Data }
        mountpoint{ /home } .

In this case, we want to build this layout in a 320G hard disk and keep the 
home partition.
If we recover system WITHOUT keeping home partition, the partition layout looks 
like:

Model: ATA ST320LT012-9WS14 (scsi)
Disk /dev/sda: 320072933376B
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start         End            Size           File system     Name        
          Flags
        17408B        20479B         3072B          Free Space
 1      20480B        99999743B      99979264B      fat32           EFI System 
Partition  boot
 2      99999744B     4100001791B    4000002048B    fat32           Recovery 
Partition
 3      4100001792B   36100001791B   32000000000B   ext4
 4      36100001792B  44100001791B   8000000000B    linux-swap(v1)
 5      44100001792B  320072916479B  275972914688B  ext4            Ubuntu Home 
Partition


But if we recovery system WITH keeping home partition, the partition layout 
looks like:

Model: ATA ST320LT012-9WS14 (scsi)
Disk /dev/sda: 320072933376B
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start          End            Size           File system     Name       
            Flags
        17408B         20479B         3072B          Free Space
 1      20480B         99999743B      99979264B      fat32           EFI System 
Partition   boot
 2      99999744B      4100001791B    4000002048B    fat32           Recovery 
Partition
 4      4100001792B    42073001983B   37973000192B   ext4
 6      42073001984B   44100001791B   2026999808B    linux-swap(v1)
 5      44100001792B   320072916479B  275972914688B  ext4            Ubuntu 
Home Partition

The behavior is abnormal.

According to my test, partman thinks the necessary space is
100+32000+8000 while the home partition is kept. And I discovered that
partman knows EFI partition has $reusemethod option and the partition
exists but it still adds the partition size to total. So the total need
(40100m) is not equal to total free (40000M) and then partman use
alternative recipe instead. This is the root cause of why partition
layout is different.

------------------------------------------------------------------------------------------------------
recipe.sh line: 187~ 209

foreach_partition () {
        local - doing IFS pcount last partition
        doing=$1
        pcount=$(echo "$scheme" | wc -l)
        last=no

        IFS="$NL"
        for partition in $scheme; do
                restore_ifs
                [ $pcount -gt 1 ] || last=yes
                set -- $partition
                eval "$doing"
                pcount=$(($pcount - 1))
        done
}

min_size () {
        local size
        size=0
        foreach_partition '
                size=$(($size + $1))'
        echo $size
}

These codes are used for calculate total recipe size, and I can't find
any expression deals with $reusemethod.

** Affects: oem-priority
     Importance: Critical
         Status: New

** Affects: partman-auto
     Importance: Undecided
         Status: New

** Also affects: partman-auto
   Importance: Undecided
       Status: New

** Package changed: partman-auto (Ubuntu) => oem-priority

** Summary changed:

- Different partition layout after recover with keep home partition
+ Different partition layout after recovery with keep home partition

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1197766

Title:
  Different partition layout after recovery with keep home partition

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/1197766/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to