Clarification regarding disk_var.sh variable significance?

Thomas Neumann blacky+fai at fluffbunny.de
Wed Mar 28 00:48:15 CEST 2012


Hello everyone

a simple gpt-enabled disk_config

disk_config disk1 disklabel:gpt
primary    -        1     -           -
primary    swap     8G    swap        sw
primary    /        4G-   xfs         rw

results in

SWAPLIST="/dev/sda2"
BOOT_DEVICE="/dev/sda"
ROOT_PARTITION="/dev/sda3"
BOOT_PARTITION="/dev/sda3"

which seems reasonable. Let's move the root partition into a logical volume

disk_config disk1 disklabel:gpt
primary -            1      -            -
primary swap         8G     swap         sw
primary -            4G-    -            -

disk_config lvm
vg vg_system disk1.3
vg_system-root      /         4G-12G    xfs  rw

results in

SWAPLIST="/dev/sda2"
BOOT_DEVICE="/dev/vg_system/root"
ROOT_PARTITION="/dev/vg_system/root"
(BOOT_PARTITION is unset)

I don't exactly understand what the variables signify. Okay, SWAPLIST is 
straightforward. But why does BOOT_DEVICE change from the physical disk 
device into a logical volume? Why is BOOT_PARTITION suddenly empty?

http://fai-project.org/doc/man/setup-storage.html says:
"If setup-storage executes successfully, an fstab(5) file matching the 
specified configuration is generated as $LOGDIR/fstab. Furthermore the 
file $LOGDIR/disk_var.sh is generated. This file defines the following 
variables, if not yet set: SWAPLIST, ROOT_PARTITION, BOOT_PARTITION 
(which is only set in case this resides on a disk drive), and 
BOOT_DEVICE. The latter two describe the partition and disk/RAID/LVM 
device hosting the mount point for /boot. If /boot has no extra mount 
point, / is used instead. You may source $LOGDIR/disk_var.sh to get the 
variables set."

a) BOOT_PARTITION (which is only set in case this resides on a disk 
drive): Does "disk drive" refer to a real partition (as opposed to 
logical volume) or maybe something completely different?

b) What is BOOT_DEVICE supposed to be? In a non-GPT & non-LVM setting I 
can use BOOT_DEVICE and BOOT_PARTITION to decide where to install grub 
(into MBR? -> $BOOT_DEVICE; into partition? -> $BOOT_PARTITION). Is that 
actually correct or just some random coincidence?


Or am I triggering some kind of artifact and heavily confuse 
setup-storage, since in a typical LVM setting /boot could not reside 
inside '/' if this partition is an LVM volume? (Something that is now 
possible with LVM2, GRUB2 and GPT disk labels?)



This disk_config works as expected:

disk_config disk1 disklabel:msdos
primary    /boot    100M  ext2        rw
primary    swap     8G    swap        sw
primary    -        4G-   -           -

disk_config lvm
vg vg_system disk1.3
vg_system-root      /         4G-12G    xfs  rw

(haven't tried switching msdos with gpt, since the whole point in using 
gpt was to get rid of /boot)

versions:
FAI: 3.4.7
setup-storage: 1.3
NFSROOT: Ubuntu natty


Successes so far
- simple partition using grub1
- simple partition using grub2 (automatic creation of grub boot partition)
- simple partition using grub2 (manual creation of grub boot partition)
- lvm partitioning with /boot using grub1
(none of these combination use a nfsroot provided grub/grub2, 
everything's set up from inside /target chroot)


More information about the linux-fai mailing list