LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   dd command... (https://www.linuxquestions.org/questions/linux-general-1/dd-command-232648/)

os2 09-19-2004 05:18 PM

dd command...
 
hi
i want to create a 2gig image file...

i tried

dd of=hd.img bs=2048 seek=1000000 count=0

i get a 1,9gig

with

dd of=hd.img bs=2048 seek=2000000 count=0

i get a 3,8gig


i checked the man page... but i don't really understant bs, seek and count....



thanks

btmiller 09-19-2004 05:57 PM

Are you purposely trying to create a sparse file (aka a file with holes in it)? Because that's what you appear to be doing. You're telling dd to skip 1000000 size 2048 blocks and then add 0 count blocks at the end. Why not try:

dd if=/dev/zero of=img bs=2048 count=1000000

That creates a zeroed out file with 1 million 2 KB blocks, which is 2 million KB or roughly 2 GB. Remember, a kilobyte is 1024 bytes (not 1000), i.e. it's based on base 2, not base 10, and so on with megabytes, gigabyes, etc. This is why the number can look slightly off of what you expect.

os2 09-19-2004 07:06 PM

Quote:

Originally posted by btmiller
Are you purposely trying to create a sparse file (aka a file with holes in it)? Because that's what you appear to be doing. You're telling dd to skip 1000000 size 2048 blocks and then add 0 count blocks at the end. Why not try:

dd if=/dev/zero of=img bs=2048 count=1000000

That creates a zeroed out file with 1 million 2 KB blocks, which is 2 million KB or roughly 2 GB. Remember, a kilobyte is 1024 bytes (not 1000), i.e. it's based on base 2, not base 10, and so on with megabytes, gigabyes, etc. This is why the number can look slightly off of what you expect.

i read
http://64.233.179.104/search?q=cache...hl=fr&ie=UTF-8

a qemu tutorial...

it said to use

dd of=hd.img bs=1024 seek=1000000 count=0

to create a 1 gig image file.....

but me i want to do a 2 gig image file....

don't know if i need to change bs and seek... or only seek

Tinkster 09-19-2004 07:53 PM

Which would be a RATHER nasty way of doing it,
the person suggesting that should be shot.

Just go with what btmiller sugested.


Warp4,
Tink :)


All times are GMT -5. The time now is 02:13 PM.