LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2010, 08:17 AM   #1
Geriao
Member
 
Registered: Dec 2009
Distribution: Ubuntu Karmic Koala, Slackware 13.0
Posts: 66

Rep: Reputation: 16
dd block input/output size


I'm trying trying to understand dd, and I'd like to know why frequently do we have to use a block read/write size, like "dd bs=1024", "dd ibs=512"...
If it executes the operation byte by byte, isn't it irrelevant? What is this block size then?

Thanks in advance!
 
Old 03-08-2010, 08:23 AM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 96
It's not necessary to read one byte, write one byte. It's not effective. Much more efficient to read a block bs, then write it. The result is the same. speed is highter. that takes advantage of a HDD buffer
 
Old 03-08-2010, 08:28 AM   #3
minrich
Member
 
Registered: Aug 2003
Location: Isles of Man & Wight
Distribution: See signature
Posts: 548

Rep: Reputation: 40
I would suggest that you first follow this link: http://www.linuxquestions.org/linux/...ything_With_DD and read the first post which has been updated to include a lot of the questions that appear later on in the thread.

The short answer to your question is: the blocksize that you select for a specific dd task depends on what sort of medium (Floppy, CD, usb, firewire drives etc., and sometimes their file systems dictate a specific choice) you write from or to. Also it can be worth experimenting with larger blocksizes when copying one partition to another - but be aware that this sometimes depends on your hardware (disk drives, and processor and RAM).

Hope this helps - post back here if you still have questions and we will wake the AwesomeMachine
 
Old 03-08-2010, 08:33 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
If I recall correctly, dd defaults to a block size of 512. As already suggested, block devices (eg disk drives) are most efficient when they get date in blocks.

Suppose you need to move 500 bricks across the street. Carrying them over 1 at a time would take a long time. Much more efficient to put them in a wheelbarrow--say 50 at a time. If you have a big wheelbarrow--and you are quite strong--you could take them in one load.

If you just need to move them a few feet, you can just throw them one at a time---now you're operating more as a serial device.
 
Old 03-09-2010, 06:25 AM   #5
Geriao
Member
 
Registered: Dec 2009
Distribution: Ubuntu Karmic Koala, Slackware 13.0
Posts: 66

Original Poster
Rep: Reputation: 16
Wow, thanks for the answers! That guide is quite good!
So, if I got it right, the cbs/ibs/bs is just limited by my RAM? Or is it my hardware (HD...)?

I'm confused about finding the right values of sectors/cylinders/heads of a HD with LBA. If, for example, my HD has 230Gb, how do I find the correct number of cylinders and sectors? Divide 230x1024x1024x1024 bytes by 512x63x255 to get the number of cylinders? 16065 times that for sectors?
 
Old 03-09-2010, 06:46 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
The output of "fdisk -l" says it all:
Code:
[root@Ath mherring]# fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Keep in mind that all this nomenclature is mostly tradition, and may have little to do with how data actually goes onto the platter.
 
Old 03-10-2010, 07:55 AM   #7
Geriao
Member
 
Registered: Dec 2009
Distribution: Ubuntu Karmic Koala, Slackware 13.0
Posts: 66

Original Poster
Rep: Reputation: 16
Ok! Thanks everyone!
I think I clarified my doubts... for now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
block size confused sang_froid Linux - Server 2 11-17-2009 08:05 AM
input and output nagavinodh Linux - Newbie 2 09-12-2009 02:17 AM
Good Memory Size and Moemory Size in lsconf output Jaimine AIX 3 05-18-2009 01:07 PM
AIX Block Size shipon_97 Linux - Newbie 1 08-11-2008 10:45 AM
block size ust Linux - Software 1 11-24-2005 11:45 PM


All times are GMT -5. The time now is 04:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration