LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   dd command help needed. (https://www.linuxquestions.org/questions/linux-newbie-8/dd-command-help-needed-879102/)

pinga123 05-05-2011 10:48 PM

dd command help needed.
 
Hi I m creating a file which will serve as a virtual harddisk .

I m using following command to create a file.

Code:

#dd if=/dev/zero of=/tmp/Sample.dat bs=1M count=1024
I have following doubts regarding the operation.
1) In above example i m creating a file with byte size of 1M .However in windows O/S (Not sure about linux here) whenever a new partition is formatted the default size will be 4096 bytes.

2) According to my assumption it doesn't make any difference as OS is anyway going to format it using mkfs.(whatever filesystem we specify).
Correct me if i m wrong.

3)Will it make any performance issue ?

TobiSGD 05-05-2011 10:57 PM

1. bs stands not for byte size, but for block size. It is only there for making it easier to calculate the resulting size of the file (at least in this case). It doesn't make any difference if you choose the standard size (512 bytes), 4096 bytes or 1 MB, as long as you choose the appropriate count-value to come to a gigabyte. This has nothing to do with the blocksize of the file-system.

2. Exactly.

3. The only performance issue you will see is when creating that file. With a blocksize of 1MB you should get a decreased creation time for that image file as when choosing 4KB. I usually choose 1MB when creating image-files (for easier calculation) and 16MB when copying from disk to disk or from image to disk (or disk to image) for better performance while copying. After the file is created you will not notice any difference in performance.


All times are GMT -5. The time now is 07:01 PM.