[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

No subject



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:
[root at cobra] /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:
[root at cobra] /tmp>file data_from_*
data_from_img:  data
data_from_sdb1: x86 boot sector, SYSLINUX bootloader (3.11)
[root at cobra] /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/

------=_Part_1298_14154328.1206020555681
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi there...<br><br>I created a Debian Live system in file debian-live-etch-small.img<br><br>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.<br>
<br>As explained on my blog ( <a href="http://pierrebauduin.blogspot.com/2008/03/plus-loin-dans-debian-live-sur-une-clef.html";>http://pierrebauduin.blogspot.com/2008/03/plus-loin-dans-debian-live-sur-une-clef.html</a>) 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&#39;t forget to set /dev/sdb2 as a bootable partition in the MBR.<br>
<br>This solution always works... unless the Debian Live binary.img is bigger than half the size of the USB key ! If you&#39;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&#39;t, since there is only 400 cylinders left on the USB key.<br>
<br>In this case the solution is to:<br>1) Look at the size of binary.img and estimate the number of cylinders (let&#39;s say n cylinders)<br>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.<br>
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: <br>dd if=/home/pbn/debian-live/debian-live-etch-small.img bs=512 skip=1 of=/dev/sdb2<br>
4) Format the first partition /dev/sdb1 as fat32 and put files on it.<br><br>... and it&#39;s done. Now you can boot off that USB key.<br><br>The problem is... the USB key fails to boot. <br>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<br>
<br>To try to understand and fix this problem I did a few things.<br><br>First I transferred the debian-live-etch-small.img to my USB key:<br>dd if=/home/pbn/debian-live/debian-live-etch-small.img of=/dev/sdb<br><br>Now to try to understand what is going wrong here is what I am doing:<br>
<br>So, with the very same Debian Live system in file debian-live-etch-small.img and on my USB stick (/dev/sdb), I&#39;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.<br>
<br>Here&#39;s what I do, I&#39;m extracting the first 5 kB of the first filesystem<br>From the file: <br>dd if=/home/pbn/debian-live/debian-live-etch-small.img bs=512 skip=1 count=10 of=data_from_img<br>Directly from the USB key: <br>
dd if=/dev/sdb1 bs=512 count=10 of=data_from_sdb1<br><br>The files have the same size, this is normal, I asked 10 times 512 bytes:<br>[root at cobra] /tmp&gt;ls -l data_from_*<br>-rw-r--r-- 1 root root 5120 2008-03-14 12:10 data_from_img<br>
-rw-r--r-- 1 root root 5120 2008-03-14 12:10 data_from_sdb1<br><br>However, they are not identical ! Look:<br>[root at cobra] /tmp&gt;file data_from_*<br>data_from_img:&nbsp; data<br>data_from_sdb1: x86 boot sector, SYSLINUX bootloader (3.11)<br>
[root at cobra] /tmp&gt;md5sum data_from_*<br>32ca18808933aa12e979375d07048a11&nbsp; data_from_img<br>8dba2755e51c9014b704b9ca66aec03c&nbsp; data_from_sdb1<br><br>... this is weird. <br>Any idea ?<br>Perhaps am I not doing it right ?<br>
<br>Cheers,<br>-- <br>Pierre Bauduin<br>Linux enthusiast since 1996<br>Linux registered user #64711<br>Debian GNU/Linux user<br>website: <a href="http://pierre.baudu.in/";>http://pierre.baudu.in/</a><br><br>

------=_Part_1298_14154328.1206020555681--



Reply to: