LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Alternatives to dd for skipping empty space (https://www.linuxquestions.org/questions/linux-hardware-18/alternatives-to-dd-for-skipping-empty-space-4175736356/)

pan64 04-26-2024 09:20 AM

Quote:

Originally Posted by mw.decavia (Post 6498390)
The sample command I just offered you ...
Code:

dd if=/dev/sda1 bs=1M skip=0 count=100 | gzip -c > test.bin.gz
Would backup all of a windows "boot" partition with free/empty space compressed to almost nothing. (if it did not fail with an error)

For example, the 100 mb "boot" partition which was standard on windows7, results in a backup file "test.bin.gz" of less than 10 mb.

Of course, you would substitute the partition you want to backup in "if=/dev/", and put it's size (in mb) in "count="

This has worked for me for backing up fairly large windows partitions. But it can backup any partition that you can read from (even "hidden" partitions), no matter what filesystem/files it contains.

this only works if the empty space is filled with zero, it doesn't contain some random values, which probably can't be compressed at all.

wpeckham 04-26-2024 11:45 AM

There are tools to zero fill deleted files and empty space on disk. The Windows ones are best used form Windows, the Linux ones are best used from Linux. I know of no tools for doing this on NTFS volumes from Linux that are perfectly safe, but that may be because it has been a decade since I had to deal with NTFS volumes!

Point being, if you used such a tool, compressed the unused space (now all zeros) then used dd with gzip (or xz) compression it would compress down that empty space by well over 98.7% making it effectively zero length in the image.

On slow iron, this may take a while no matter what OS you are using. For safety, I would allocate adequate time, start in Windows, and once the zero fill and space consolidation done do the backup image from Linux and see how that works. That will be using each OS for what it is good at, and avoiding using them for things for which they are less than optimal.

friendlysalmon8827 04-26-2024 06:38 PM

I can remember the days when I first installed Linux on a off lease Compac desk pro that my father had managed to procure for me as an off lease from his employer. I also learned the fips methods to dual-boot windows XP Home and pre IBM Red Hat Linux on my daily driver gaming pc.

From there I dove straight into setting up a local area network file and print server using the same Red Hat CD that I got when I( purchased a phone-book sized manual for Red Hat. I can also remember having to go through the pain of using the b43-firmwarecutter utility to get a broadcom chipset based WiFi or Ethernet card functional.

It's always a good idea to take a backup of your important personal and customized configuration files in the /etc directory. I'd also strongly that the OP consider investing a whole separate. hard disk drive(HDD or spinning rust) as spinning rust drives are dropping like a stone price wise.

JASlinux 05-07-2024 06:28 AM

Quote:

Originally Posted by mw.decavia (Post 6498390)
Code:

dd if=/dev/sda1 bs=1M skip=0 count=100 | gzip -c > test.bin.gz
For example, the 100 mb "boot" partition which was standard on windows7, results in a backup file "test.bin.gz" of less than 10 mb.

Of course, you would substitute the partition you want to backup in "if=/dev/", and put it's size (in mb) in "count="

Why would you force a source partition size with
Code:

bs=1M count=100
?


All times are GMT -5. The time now is 11:08 PM.