[parted-devel] [BUG] parted does not preserve bootcode in extended partition

Petr Uzel petr.uzel at suse.cz
Thu Jan 22 15:43:41 UTC 2009


Hi!

I've just discovered $SUBJ.

Steps to reproduce :

1) Create msdos label with extended partition, e.g.
~ # parted /dev/hdd
GNU Parted 1.8.8
Používám /dev/hdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: WDC WD153BA (ide)
Disk /dev/hdd: 15,4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Přepínače
1      32,3kB  1999MB  1999MB  primary   ext3         boot, , , , , , , , , type=83, ,
2      1999MB  15,4GB  13,4GB  extended               , , , , , , lba, , , type=0f, ,
5      1999MB  3997MB  1999MB  logical   ext3         , , , , , , , , , type=83, ,
6      3998MB  5996MB  1999MB  logical   ext3         , , , , , , , , , type=83, ,

2) install grub to extended partition

3) save bootcode
# dd if=/dev/hdd2 of=part_before bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00052518 s, 975 kB/s

# hexdump -v part_before
0000000 48eb 0090 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
0000030 0000 0000 0000 0000 0000 0000 0000 0203
0000040 0080 8000 9c4e 08f0 0800 90fa f690 80c2
0000050 0275 80b2 59ea 007c 3100 8ec0 8ed8 bcd0
0000060 2000 a0fb 7c40 ff3c 0274 c288 be52 7d81
0000070 36e8 f601 80c2 5674 41b4 aabb cd55 5a13
0000080 7252 814b 55fb 75aa a045 7c41 c084 3e78
0000090 0575 e183 7401 6637 4c8b be10 7c05 44c6
00000a0 01ff 8b66 441e c77c 1004 c700 0244 0001
00000b0 8966 085c 44c7 0006 6670 c031 4489 6604
00000c0 4489 b40c cd42 7213 bb05 7000 7deb 08b4
00000d0 13cd 0a73 c2f6 0f80 e884 e900 008d 05be
00000e0 c67c ff44 6600 c031 f088 6640 4489 3104
00000f0 88d2 c1ca 02e2 e888 f488 8940 0844 c031
0000100 d088 e8c0 6602 0489 a166 7c44 3166 66d2
0000110 34f7 5488 660a d231 f766 0474 5488 890b
0000120 0c44 443b 7d08 8a3c 0d54 e2c0 8a06 0a4c
0000130 c1fe d108 6c8a 5a0c 748a bb0b 7000 c38e
0000140 db31 01b8 cd02 7213 8c2a 8ec3 4806 607c
0000150 b91e 0100 db8e f631 ff31 f3fc 1fa5 ff61
0000160 4226 be7c 7d87 40e8 eb00 be0e 7d8c 38e8
0000170 eb00 be06 7d96 30e8 be00 7d9b 2ae8 eb00
0000180 47fe 5552 2042 4700 6f65 006d 6148 6472
0000190 4420 7369 006b 6552 6461 2000 7245 6f72
00001a0 0072 01bb b400 cd0e ac10 003c f475 00c3
00001b0 0000 0000 0000 0000 0000 0000 0000 0100
00001c0 f301 fe83 e57f 003f 0000 90f4 003b 0000
00001d0 e641 fe05 d8bf 9133 003b 9133 003b 0000
00001e0 0000 0000 0000 0000 0000 0000 0000 0000
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000200


4) make some changes to the disk to make parted rewrite the
partitions

# parted /dev/hdd
GNU Parted 1.8.8
Using /dev/hdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) set 1 boot on
(parted) quit
Information: You may need to update /etc/fstab.

5) see that bootcode is gone
# dd if=/dev/hdd2 of=part_after bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000299465 s, 1.7 MB/s

# hexdump -v part_after
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
0000030 0000 0000 0000 0000 0000 0000 0000 0000
0000040 0000 0000 0000 0000 0000 0000 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
0000060 0000 0000 0000 0000 0000 0000 0000 0000
0000070 0000 0000 0000 0000 0000 0000 0000 0000
0000080 0000 0000 0000 0000 0000 0000 0000 0000
0000090 0000 0000 0000 0000 0000 0000 0000 0000
00000a0 0000 0000 0000 0000 0000 0000 0000 0000
00000b0 0000 0000 0000 0000 0000 0000 0000 0000
00000c0 0000 0000 0000 0000 0000 0000 0000 0000
00000d0 0000 0000 0000 0000 0000 0000 0000 0000
00000e0 0000 0000 0000 0000 0000 0000 0000 0000
00000f0 0000 0000 0000 0000 0000 0000 0000 0000
0000100 0000 0000 0000 0000 0000 0000 0000 0000
0000110 0000 0000 0000 0000 0000 0000 0000 0000
0000120 0000 0000 0000 0000 0000 0000 0000 0000
0000130 0000 0000 0000 0000 0000 0000 0000 0000
0000140 0000 0000 0000 0000 0000 0000 0000 0000
0000150 0000 0000 0000 0000 0000 0000 0000 0000
0000160 0000 0000 0000 0000 0000 0000 0000 0000
0000170 0000 0000 0000 0000 0000 0000 0000 0000
0000180 0000 0000 0000 0000 0000 0000 0000 0000
0000190 0000 0000 0000 0000 0000 0000 0000 0000
00001a0 0000 0000 0000 0000 0000 0000 0000 0000
00001b0 0000 0000 0000 0000 0000 0000 0000 0100
00001c0 f301 fe83 e57f 003f 0000 90f4 003b 0000
00001d0 e641 fe05 d8bf 9133 003b 9133 003b 0000
00001e0 0000 0000 0000 0000 0000 0000 0000 0000
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000200


I'm going to try to fix is ASAP, but as I'm a little bit lost in
corresponding code, any help/patch would be very welcome :)


Thanks,


-- 
Best regards / s pozdravem

Petr Uzel, Packages maintainer
---------------------------------------------------------------------
SUSE LINUX, s.r.o.                          e-mail: puzel at suse.cz
Lihovarská 1060/12                          tel: +420 284 028 964
190 00 Prague 9                             fax: +420 284 028 951
Czech Republic                              http://www.suse.cz



More information about the parted-devel mailing list