Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Disk tools confusion: dd or cat or cp?

  1. #11
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,671
    Blog Entries
    1

    Default Re: Disk tools confusion: dd or cat or cp?

    Quote Originally Posted by hcvv View Post
    It is also my impression that blocksize isn't that important anymore (for performance). Todays revolving disks have firmware that probably produce another blocksize then the real one on the disk.

    A very rare usage I know of is when you want to copy the Master Boot record, which is the first 440 bytes of the first block of the disk. Thus bs=440 and count=1 will address that without touuching the partition table taht comes after those 440 bytes.
    Actually block size is supremely important today for performance (and management).
    Traditionally, 256 bytes was the standard block size for practically everything... data storage, transfer, etc.

    When gigabyte (and now today's terabyte) drives started appearing the Advanced Format (4k) block size was proposed and largely implemented everywhere (I've never verified whether it was formally standardized). Of course the larger block size reduces overhead and enables mapping large amounts of data with far fewer pointers. But, it can also result in mis-alignment.

    https://en.wikipedia.org/wiki/Advanced_Format

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  2. #12

    Default Re: Disk tools confusion: dd or cat or cp?

    Yet again thanks very much for all your advise.

    So finally,

    if creating an ISO file from physical CD/DVD by using dd with no parameters -i.e., all defaults-, will I actually get an ISO file of full 700 Mb size (or 4.7 Gb for DVD) *regardless* of how much data physical CD actually has stored?

    @tsu2:
    then, for whatever activity I need to do with dd (writing to some disk, disk/partition cloning, etc), is there a way to deduce the optimal "correct" values for "bs" and "count" parameters?
    How can one tell?

    Thanks yet again.

  3. #13
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,052
    Blog Entries
    3

    Default Re: Disk tools confusion: dd or cat or cp?

    Quote Originally Posted by F_style View Post
    if creating an ISO file from physical CD/DVD by using dd with no parameters -i.e., all defaults-, will I actually get an ISO file of full 700 Mb size (or 4.7 Gb for DVD) *regardless* of how much data physical CD actually has stored?
    I don't think so.

    When a CD is mounted, you could try:
    Code:
    wc -c /dev/cdrom
    to see how many bytes you get when reading it. And I'm pretty sure that's what "dd" will copy to the generated file.

    then, for whatever activity I need to do with dd (writing to some disk, disk/partition cloning, etc), is there a way to deduce the optimal "correct" values for "bs" and "count" parameters?
    You primarily need the "bs" and "count" parameters when you are trying to explicitly control how much data you are copying. Apart from that, the use of "bs" is mostly about optimizing performance, and that depends on your hardware.
    openSUSE Leap 15.1; KDE Plasma 5;

  4. #14
    Join Date
    Sep 2012
    Posts
    4,926

    Default Re: Disk tools confusion: dd or cat or cp?

    Quote Originally Posted by nrickert View Post
    Apart from that, the use of "bs" is mostly about optimizing performance, and that depends on your hardware.
    Originally dd was created for working with tapes where block size mattered - it was exactly the underlying device block size. Using wrong block size could return incomplete data (because every IO would have fetched new physical tape block and if you requested smaller size, the rest of block was discarded). dd was also used to exchange data between Unix and other systems using fixed-size records (here is where conv=block/unblock options originate from initially) where block size had to match record size.

    Linux does not really have character disk devices in the old Unix sense, so here block sizes are hidden by driver and it does not really matter indeed. It still matters for tapes though.

  5. #15
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,638

    Default Re: Disk tools confusion: dd or cat or cp?

    Quote Originally Posted by F_style View Post
    if creating an ISO file from physical CD/DVD by using dd with no parameters -i.e., all defaults-, will I actually get an ISO file of full 700 Mb size (or 4.7 Gb for DVD) *regardless* of how much data physical CD actually has stored?
    That dpeneds of course on what is on that CD/DVD. There should be an ISO file system on it to start with.
    And then it depends on what you tell dd to do. You want to stickuse no parameters and stick to the defaults, but the defaults for if is stdin and for of is stdout. Thus the defaults will not work on any CD/DVD.
    Henk van Velden

  6. #16

    Default Re: Disk tools confusion: dd or cat or cp?

    Sorry, the question was totally wrong.

    I meant, if creating an ISO file from physical CD/DVD by using dd with no parameters --i.e., all defaults *except* input and output files of course--, will I actually get an ISO file of full 700 Mb size (or 4.7 Gb for DVD) *regardless* of how much data physical CD actually has stored?

    And, for writing the openSUSE DVD ISO into USB stick, does it not need bs nor count parameters?

  7. #17
    Join Date
    Oct 2014
    Location
    Italy
    Posts
    1,661

    Default Re: Disk tools confusion: dd or cat or cp?

    Just did:
    Code:
    bruno@LT_B:~/Downloads> sudo dd if=openSUSE-Leap-15.1-NET-x86_64-Build468.1-Media.iso of=/dev/sdc
    [sudo] password for root: 
    256000+0 records in
    256000+0 records out
    131072000 bytes (131 MB, 125 MiB) copied, 30,3008 s, 4,3 MB/s
    bruno@LT_B:~/Downloads>
    and the result is:
    Code:
    bruno@LT_B:~> sudo fdisk -l
    ...
    Disk /dev/sdc: 3,7 GiB, 4005527552 bytes, 7823296 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x0ecd85f4
    
    Device     Boot Start    End Sectors   Size Id Type
    /dev/sdc1         276   8087    7812   3,8M ef EFI (FAT-12/16/32)
    /dev/sdc2  *     8088 255999  247912 121,1M 17 Hidden HPFS/NTFS
    bruno@LT_B:~>
    I think the output speak for itself.
    Main: Leap 15 Gnome on i7 4720HQ + Geforce GTX960M
    Test: Leap 42.3 (& others) on Core2Duo + GM965

  8. #18
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,638

    Default Re: Disk tools confusion: dd or cat or cp?

    Quote Originally Posted by F_style View Post
    Sorry, the question was totally wrong.

    I meant, if creating an ISO file from physical CD/DVD by using dd with no parameters --i.e., all defaults *except* input and output files of course--, will I actually get an ISO file of full 700 Mb size (or 4.7 Gb for DVD) *regardless* of how much data physical CD actually has stored?

    And, for writing the openSUSE DVD ISO into USB stick, does it not need bs nor count parameters?
    There is no "of course" when talking to computers. The system will do what you tell it to do, not what you think you told it to do.

    And I try to emulate this to avoid confusion as much as possible.

    Thus when you say you specify if= and of=, as long as you do not tell what the values are, I can not confirm what most probably will happen.

    Also (again), when there is no ISO file system on the CD/DVD (e.g. when it is a music CD), the result will not be a so called ISO file.

    And no, you do not need a bs and/or count parameter when you copy the openSUSE ISO file to a USB mass-meory device.
    Didn't you read the instructions on https://en.opensuse.org/SDB:Live_USB_stick?
    There it says:
    Code:
    dd if=/path/to/downloaded.iso of=/dev/sdX
    Isn't that clear enough?
    Henk van Velden

  9. #19

    Default Re: Disk tools confusion: dd or cat or cp?

    Sorry if I'm being annoying again.
    I think I'm done with questions indeed.

    And yes, I had read already the SDB page, and what I read is
    Code:
    # dd if=/path/to/downloaded.iso of=/dev/sdX bs=4M status=progress && sync
    But thanks again.

  10. #20
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,025

    Default Re: Disk tools confusion: dd or cat or cp?

    Just a note, the "bs=" parameter can (and in my experience, does)
    increase the write throughput, to a point.

    Jim



    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •