Discussion:
How important is the MBR partition offset of grub-mkrescue ?
Andrey Borzenkov
2013-11-04 12:08:43 UTC
Permalink
=F7 Sun, 03 Nov 2013 18:16:09 +0100
Hi,
=20
i believe to have found the udev rules in Debian 6 which
govern the population of /dev/disk/by-label.
=20
File
/lib/udev/rules.d/60-persistent-storage.rules
has
# probe filesystem metadata of disks
KERNEL!=3D"sr*", IMPORT{program}=3D"/sbin/blkid -o udev -p $tempnod=
e"
...
ENV{ID_FS_LABEL_ENC}=3D=3D"?*", ENV{ID_FS_USAGE}=3D=3D"filesyst=
em|other", \
SYMLINK+=3D"disk/by-label/$env{ID_FS_LABEL_ENC}"
=20
I understand that if blkid sets variable ID_FS_LABEL_ENC to
a non-empty value, then this will become the link name in ./by-label.
The link target is the device that is being examined by the rule.
=20
=20
$ /sbin/blkid -o udev -p /dev/sdb=20
ID_PART_TABLE_TYPE=3Ddos
ID_FS_LABEL=3Depidemic-4.1-b1-1-ts-amd64
ID_FS_LABEL_ENC=3Depidemic-4.1-b1-1-ts-amd64
ID_FS_TYPE=3Diso9660
ID_FS_USAGE=3Dfilesystem
$ /sbin/blkid -o udev -p /dev/sdb1
$
=20
So why the hell does /dev/sdb1 become link target ?
Its ID_FS_LABEL_ENC must be empty.
=20
Any idea how to get a verbous log of these decisions ?
=20
I confirm this. The culprit is this rule in 60-persistent-storage.rules=
:

# for partitions import parent information
ENV{DEVTYPE}=3D=3D"partition", IMPORT{parent}=3D"ID_*"

I'm not really sure how exactly to fix it. I.e. normally it is assumed
that device is either partitioned or not. Situation when we have
filesystem on a whole disk *and* individual partitions ... not sure.

I'm interested in which information actually needs to be imported from
parent. May be it should be less aggressive.
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug=
" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thomas Schmitt
2013-11-04 15:44:59 UTC
Permalink
Hi,
Post by Andrey Borzenkov
# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
I'm not really sure how exactly to fix it. I.e. normally it is assumed
that device is either partitioned or not. Situation when we have
filesystem on a whole disk *and* individual partitions ... not sure.
I'm interested in which information actually needs to be imported from
parent. May be it should be less aggressive.
Background:
I started this discussion on grub-devel because the problem
shows up with bootable ISO 9660 images produced by grub-mkrescue.

These images are suitable for booting from CD/DVD and from
USB stick. They begin by an MBR which marks a single partition
beginning at LBA 1. The ISO filesystem has to begin at LBA 0,
because else it would not be bootable from CD/DVD.
So the partition is not mountable, intentionally. It just protects
the ISO filesystem from partition editors and alike, but leaves
the MBR unclaimed in order to please some boot firmware.

Nevertheless the partition shows up as link in /dev/disk/by-label
under the name of the ISO filesystem Volume Id.

After Andrey Borzenkov pointed me to IMPORT{parent}, i added
statements to reset the blkid ID_FS_* properties:

ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*", \
ENV{ID_FS_LABEL}="" , ENV{ID_FS_LABEL_ENC}="" , \
ENV{ID_FS_TYPE}="" , ENV{ID_FS_USAGE}=""

I hope this is not a totally stupid beginner's mistake.
At least it solved the problem on my system.
Now the link points to /dev/sdb rather than to /dev/sdb1.

So i assume that before the change, the partition link overwrote
the disk link.


Have a nice day :)

Thomas

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...