Find the answer to your Linux question:
Results 1 to 8 of 8
Hi I'm a linux user for some time now and most stuff I can figure out myself. Though, this one drives me crazy and I did not find any information ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2009
    Location
    Wil, Switzerland
    Posts
    10

    Copy of a partition using dd gets bigger than the original partition


    Hi

    I'm a linux user for some time now and most stuff I can figure out myself. Though, this one drives me crazy and I did not find any information on the internet.

    I have a partition, say,
    Code:
    /dev/sda1
    , which is 128MB big. When I copy it using
    Code:
    dd if=/dev/sda1 of=/home/me/backup_sda1.img
    , the resulting file is 134MB big. Now my problem is that I want to copy that partition as-is to a CF card, which does not work because the image is bigger than the partition on the CF card.

    Why does dd create bigger files? Shouldn't it be exactly same sized like the source?

    Thanks

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,218
    are you sure, that the partiton itself is 128MB?
    Or does the _file_system_ report 128MB total?

    In the later case, the partition would logically be bigger.

    what does fdisk -l /dev/sda say?

  3. #3
    Just Joined!
    Join Date
    Aug 2009
    Location
    Wil, Switzerland
    Posts
    10
    > are you sure, that the partiton itself is 128MB?

    hm.. not anymore, no...

    Code:
    moon ~ # df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/sda3              3548952   2072076   1286908  62% /
    udev                     10240       136     10104   2% /dev
    /dev/sda1               132206      8127    117253   7% /boot
    shm                      30024         0     30024   0% /dev/shm
    /dev/sda1 seems to be bigger than 128M. I've used fdisk to partition it and there I said "+128M", so I'm not sure why it's over 130M.

    The same is with all other partitions, they're slightly bigger than what I've told fdisk.

    Strange. So the problem lies in the partition size, not dd. Should have figured out this by myself.

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,218
    afaik,
    fdisk (or any other partitioner) has to round up the user input,
    so that it matches the harddisc geometry.
    Rounds up to.. a full cylinder? But I could be wrong with "cylinder" here.

  5. #5
    Just Joined!
    Join Date
    Aug 2009
    Location
    Wil, Switzerland
    Posts
    10
    Hmm. yeah. Dunno if it's cylinder, but I thought it'll round DOWN, not up. It's kinda strange though. I created the partition on the CF card the same way, so I thought it'll be the same size then. But maybe the CF card has 128M now (can't check right now) because fdisk hadn't to round it up because it's not a mechanical hard drive.

  6. #6
    Just Joined!
    Join Date
    Oct 2007
    Posts
    15

    Ntfs & ext3

    can you please run :
    Code:
    fdisk -l
    If you notice that the file you are copying is under NTFS file system and copied to EXT3 file system, it is normal to notice increase of file size as journaling files are created. Try then copied to EXT2 ,NTFS ,FAT32 or FAT to avoid file system journals beaing created.

    Maybe there are some options on dd to order it not to create file systems files.
    cheers !

  7. #7
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,218
    sorry, but
    1) ntfs does have a journal
    2) it was already determined that the partition on the harddisc is bigger than 128MB
    3) dd does not care about filesystems. So there are no fs options to it

  8. #8
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    The file system is a non-issue. This is raw access.

    Possible issues are missaligned partitions and GiB (base 2, multiples of 1024) vs GB (base 10, multiples of 1000). This happens because each program counts in a different way, whatever its author thinks is cooler.

    The + sign (it could be a - as well) in fdisk means that rounding has taken place. Fdisk counts blocks, disk controllers count sectors.

Posting Permissions

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