motivational example which looks wrong, but works
[gnt-info] / doc / deboostrap-4k-msdos.txt
1 This is working configuration:
2
3 + ssh r1u28.gnt.ffzg.hr fdisk -l /var/run/ganeti/instance-disks/armbian:0
4 Disk /var/run/ganeti/instance-disks/armbian:0: 40 GiB, 42949672960 bytes, 10485760 sectors
5 Units: sectors of 1 * 4096 = 4096 bytes
6 Sector size (logical/physical): 4096 bytes / 4096 bytes
7 I/O size (minimum/optimal): 4096 bytes / 4096 bytes
8 Disklabel type: dos
9 Disk identifier: 0xa25190c0
10
11 Device                                     Boot Start      End  Sectors  Size Id Type
12 /var/run/ganeti/instance-disks/armbian:0p1 *     2048 83886079 83884032  320G 83 Linux
13
14 confused yet? Why is partition size 320G when disk is only 40G?
15
16
17 This is a story about booting ganeti instances from kernel inside virtual machine.
18 We are using ganeti-instance-debootstrap to create instances and have disk with 4k
19 blocks:
20
21 # blockdev --getbsz /dev/md127 
22 4096
23
24 For this to work, we need msdos partition table which is configured with
25
26 root@r1u32:~# grep ^PARTITION_STYLE /etc/default/ganeti-instance-debootstrap 
27 PARTITION_STYLE="msdos"
28
29 This should create one partition, offset by 1M (using default):
30
31 root@r1u32:~# tail -8 /etc/default/ganeti-instance-debootstrap 
32
33 # PARTITION_ALIGNMENT: the alignment of the partitions in sectors
34 # (512B); this defaults to 1MiB to give grub enough space for
35 # embedding and for better alignment with modern media (HDDs and
36 # SSDs), feel free to increase it if your media has even bigger
37 # allocation blocks
38 PARTITION_ALIGNMENT=2048
39
40 This however doesn't work if we are using 4k blocks on device because
41 offset of first partition stored in old primary partition chs format won't
42 match with different blocksize.
43
44 Solution is to create new partition table after debootstrap (which needs
45 host view of partition table with 4k block) using loopback which has 512b
46 blocksize.
47
48 Patch for this is: deboostrap-4k-msdos.diff
49
50 This patch is submitted to upstream: https://github.com/ganeti/instance-debootstrap/pull/2