Operating System - Linux
1833303 Members
2959 Online
110051 Solutions
New Discussion

how to know about the "seek" of one file in a block device

 
SOLVED
Go to solution

how to know about the "seek" of one file in a block device

for example,one file in fd0, I what to dd seek=XXX, but how to know one file has been in the fd0, of course, it writen into the disk continuously before.

ps: I am making one bootable flash for embed linux.

Best Regards,
Frederick
frederick van targero
3 REPLIES 3
Goran Koruga
Honored Contributor

Re: how to know about the "seek" of one file in a block device

Hi.

What exactly do you mean with this ? I am not sure I fully understand your problem so I will not comment for now.

G.

Re: how to know about the "seek" of one file in a block device

it is that the procedure for a boot-floppy building:
dd if=KERNEL of=/dev/fd0 bs=1k

dd if=rootfs.gz of=/dev/fd0 bs=1k seek=KERNEL_BLOCKS,

now I did the similar process in a DiskOnModule flash IDE disk, but one initrd.gz add behind the bzImage, for the cylinder of initrd.gz has been marked by lilo running, (I think), so far the flash has been fixed in one fireware mainboard, i can not access it by other system, neither no lilo programm inside, in other words, no way to run lilo again, but I have to make change for the initrd.gz. since I can not override the old file, so I wnat to dd(seek=xxx) the new initrd.gz inside to the old initrd.gz located. However, I must to know what is the seek of old file locate(the first cylinder or block).

Best Regards,
Frederick

frederick van targero
Goran Koruga
Honored Contributor
Solution

Re: how to know about the "seek" of one file in a block device

Hi.

The standard is to place it on first free block directly after the kernel image. So try using this approach, i.e. find the kernel size, divide it with 512 and round it up. Check if the next sector is really a compressed file system (you can use file on it, it shoul didentify it as gzip compressed data).

Hope this helps,
Goran