Hi there... I created a Debian Live system in file debian-live-etch-small.img
I want to change the order of the partitions on the USB key. In the Debian Live system, there is only the /dev/sdb1 Debian Live partition, then free space. I want to move the Debian Live partition at the end of the USB key and create a DOCUMENTS partition as first partition. This is because Windows will only mount the first partition of a USB key. As explained on my blog ( http://pierrebauduin.blogspot.com/2008/03/plus-loin-dans-debian-live-sur-une-clef.html) the solution I found is to create a new /dev/sdb2 partition at the end of the USB key which has the very same number of cylinders as /dev/sdb1. Then you dd from /dev/sdb1 to the newly created /dev/sdb2 partition. Then you can erase /dev/sdb1 and create a new DOCUMENTS /dev/sdb1 partition that will occupy the free space before the /dev/sdb2 partition. Don't forget to set /dev/sdb2 as a bootable partition in the MBR. This solution always works... unless the Debian Live binary.img is bigger than half the size of the USB key ! If you've got say, 1000 cylinders on your USB key, and the partition in binary.img takes up 600 cylinders, you would need to create a 600 cylinders partition at the end of the USB key. But you can't, since there is only 400 cylinders left on the USB key. In this case the solution is to: 1) Look at the size of binary.img and estimate the number of cylinders (let's say n cylinders) 2) Using fdisk and/or cfdisk, create two partitions on the USB key: /dev/sdb2 has n cylinders, and /dev/sdb1 has the rest of the space. Partition /dev/sdb2 must be set as bootable in the MBR. 3) Extract the first partition from binary.img. In binary.img there is first the MBR, then the first partition. The MBR has always a size of 512 bytes. Thus you need to do: dd if=/home/pbn/debian-live/debian-live-etch-small.img bs=512 skip=1 of=/dev/sdb2 4) Format the first partition /dev/sdb1 as fat32 and put files on it. ... and it's done. Now you can boot off that USB key. The problem is... the USB key fails to boot. And the reason is that when you do dd if=/home/pbn/debian-live/debian- live-etch-small.img bs=512 skip=1 you *do not get the first filesystem* from debian-live-etch-small.img To try to understand and fix this problem I did a few things. First I transferred the debian-live-etch-small.img to my USB key: dd if=/home/pbn/debian-live/debian-live-etch-small.img of=/dev/sdb Now to try to understand what is going wrong here is what I am doing: So, with the very same Debian Live system in file debian-live-etch-small.imgand on my USB stick (/dev/sdb), I'm trying to extract the first filesystem. This means skipping the MBR which is at the beginning of debian-live-etch-small.img and is 512 bytes long. Here's what I do, I'm extracting the first 5 kB of the first filesystem >From the file: dd if=/home/pbn/debian-live/debian-live-etch-small.img bs=512 skip=1 count=10 of=data_from_img Directly from the USB key: dd if=/dev/sdb1 bs=512 count=10 of=data_from_sdb1 The files have the same size, this is normal, I asked 10 times 512 bytes: [EMAIL PROTECTED] /tmp>ls -l data_from_* -rw-r--r-- 1 root root 5120 2008-03-14 12:10 data_from_img -rw-r--r-- 1 root root 5120 2008-03-14 12:10 data_from_sdb1 However, they are not identical ! Look: [EMAIL PROTECTED] /tmp>file data_from_* data_from_img: data data_from_sdb1: x86 boot sector, SYSLINUX bootloader (3.11) [EMAIL PROTECTED] /tmp>md5sum data_from_* 32ca18808933aa12e979375d07048a11 data_from_img 8dba2755e51c9014b704b9ca66aec03c data_from_sdb1 ... this is weird. Any idea ? Perhaps am I not doing it right ? Cheers, -- Pierre Bauduin Linux enthusiast since 1996 Linux registered user #64711 Debian GNU/Linux user website: http://pierre.baudu.in/
_______________________________________________ debian-live-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/debian-live-devel

