FedoraForum.org - Fedora Support Forums and Community
Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2018
    Location
    Finland
    Posts
    40
    Linux (Fedora) Chrome 67.0.3396.79

    Question Does dd also copy unused space in partition?(And how to avoid that?)

    Hi, I'm not currently needing backup of my system, but been wondering how to do it when necessary.
    It seems dd is simple solution, but I have understood that it creates image of whole partition including unused space. So is there a way to only get dd create copy of used space or should I just resize my partition to minimum possible while I take backup?

  2. #2
    Join Date
    Dec 2017
    Location
    Sosnowiec, PL
    Age
    35
    Posts
    20
    Linux Firefox 61.0

    Re: Does dd also copy unused space in partition?(And how to avoid that?)

    [...] or should I just resize my partition to minimum possible while I take backup?
    What for? It's redundant, unneeded work.

    Look here:
    https://wiki.archlinux.org/index.php/Partclone
    https://wiki.archlinux.org/index.php...#Using_e2image

    There is albo mentioned fsarchiver.

    You can also do a traditional tar.XX copy:
    https://wiki.archlinux.org/index.php...ckup#Using_tar .

    Of course do some practice eg. on virtualbox.
    marcin82

  3. #3
    Join Date
    Oct 2011
    Posts
    1,798
    Linux Chrome 67.0.3396.87

    Re: Does dd also copy unused space in partition?(And how to avoid that?)

    I don't think so, at least not easily. Data gets written all across the partition, dd is a raw tool that doesn't understand filesystems or data.
    One trick is to zero out the unused space before taking the image and compressing it. That would help compressing algorithm to at least cut the image size by unused space.

  4. #4
    Join Date
    Nov 2004
    Location
    MT USA
    Posts
    910
    Windows 7 Firefox 61.0

    Re: Does dd also copy unused space in partition?(And how to avoid that?)

    I'd be looking at using clonezilla for a complete system backup. It does work well.

    That said, I keep my data and OS separate (on separate drives) . I backup my data with rsync to external drives. I can easily re-install the OS at get back to where I was but the data I cannot. I have other computers, so down time is not a problem, otherwise I'd be looking at mirroring/raid solutions for 100% uptime.

  5. #5
    Join Date
    Jun 2005
    Location
    Montreal, Que, Canada
    Posts
    5,166
    Linux (Fedora) Firefox 61.0

    Re: Does dd also copy unused space in partition?(And how to avoid that?)

    If it's to create a mirror image of a partition consider using rsync man rsync for more information

    I use it to backup files. rsync does not keep generations, so, if you backup abc on the source and there is an abc on the backup, it will replace same.
    If the source/target files are identical, (date, path/name, etc, a copy will not be done)
    Leslie in Montreal

    Interesting web sites list
    http://forums.fedoraforum.org/showth...40#post1697840

  6. #6
    Join Date
    Jul 2010
    Location
    western PA
    Posts
    110
    Linux (Fedora) Firefox 61.0

    Re: Does dd also copy unused space in partition?(And how to avoid that?)

    you are correct. dd does copy empty space because it is a generic block level copy. As others noted, when you start trying to be smart about it your backup program must have some knowledge of the overlying filesystem so that it knows what blocks need to be copied. I've used clonezilla sith some success but I noticed several drawbacks. 1) It would not copy to a smaller target disk, even if the occupied space was less than what the target would hold. 2) it would not correctly handle UEFI systems, even though the documentation said it would...and this was with the updated version that claimed to support UEFI...and no, secure boot was not active.

  7. #7
    Join Date
    Dec 2013
    Location
    United Kingdom
    Posts
    6,138
    Linux Firefox 61.0

    Re: Does dd also copy unused space in partition?(And how to avoid that?)

    Quote Originally Posted by keikari
    while I take backup?
    if you are concerned about the redundant space taking up backup room, use rsync or one of the GUI packages that make use of rsync instead.

    I run the following command to take a system backup with rsync. the exclusions skip the stuff the pc automatically generates during the boot process and are not permanent or needed files. to restore it, you just swap the input and output paths. e.g.

    backup -
    Code:
    rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /run/media/antikythera/Buffalo/Aures/
    restore -
    Code:
    rsync -aAXv  --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /run/media/antikythera/Buffalo/Aures/ /

  8. #8
    Join Date
    Apr 2018
    Location
    Finland
    Posts
    40
    Linux (Fedora) Chrome 67.0.3396.79

    Re: Does dd also copy unused space in partition?(And how to avoid that?)

    Thanks for all the answers, as new user this really helps to find stuff to read about. It seems the partclone/clonezilla is best option for me. I didn't realize that I should have mentioned that I only have one 240GB SSD and I have only one partition in it.(I have kind of slow HDD Network Hard Drive where I can save back-up) I basically need to create backup of whole system only when I'm expecting that there might be a chance to mess up things too bad. (Like updating instead of clean installing)

Similar Threads

  1. Remove unused space from Vg LVM2
    By Sagitter in forum Hardware & Laptops
    Replies: 11
    Last Post: 11th October 2013, 08:35 AM
  2. [SOLVED]
    unused LVM space
    By vinicius in forum Hardware & Laptops
    Replies: 0
    Last Post: 11th November 2012, 02:39 AM
  3. unused space in lvm to ntfs
    By Jalovcan in forum Using Fedora
    Replies: 0
    Last Post: 5th January 2012, 10:59 AM
  4. Create a new partition in unused LVM space
    By joe.pelayo in forum Using Fedora
    Replies: 4
    Last Post: 15th June 2011, 02:28 PM
  5. How to make use of unused space ...
    By the_tragic_hip in forum Using Fedora
    Replies: 10
    Last Post: 17th June 2005, 08:40 PM

Posting Permissions

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