LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-23-2024, 04:29 PM   #1
JASlinux
Member
 
Registered: Oct 2020
Posts: 380

Rep: Reputation: Disabled
Question Alternatives to dd for skipping empty space


I am attempting to archive a 240G internal SSD.

In the past I've experience difficulties using dd with command line compression, speed & I/O errors.

Anyone using an alternative Linux utility for backup images of only used partition space (currently < 40GB)?
 
Old 04-23-2024, 04:37 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,659

Rep: Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708Reputation: 2708
Have you looked into PARTCLONE or FSARCHIVER?
 
Old 04-24-2024, 02:17 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,899

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
if you backup a full partition there is no used/free space, this information is not available.
If you backup files/dirs you can obviously skip "free" space. You can use for example rsync to do that.
 
Old 04-24-2024, 09:59 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,780

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
Quote:
Originally Posted by pan64 View Post
if you backup a full partition there is no used/free space, this information is not available.
Tools like partclone can produce a backup that does not include a supported filesystem's free space. Partclone's image format includes only the used space, and can optionally be compressed. If you play the game right with losetup, you can even produce a mountable sparse file that looks like the original filesystem but does not allocate any disk blocks for the free space.
 
Old 04-24-2024, 10:08 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,899

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Quote:
Originally Posted by rknichols View Post
Tools like partclone can produce a backup that does not include a supported filesystem's free space. Partclone's image format includes only the used space, and can optionally be compressed. If you play the game right with losetup, you can even produce a mountable sparse file that looks like the original filesystem but does not allocate any disk blocks for the free space.
yes, partclone works on the filesystem, but dd has no any idea about that (including partclone.dd).
 
Old 04-24-2024, 09:59 PM   #6
JASlinux
Member
 
Registered: Oct 2020
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
If you backup files/dirs you can obviously skip "free" space. You can use for example rsync to do that.
Right, Linux, but this is a laptop Redmond partition with its hidden/system file nonsense. It needs to be a partition backup without the blank space.

I will check out PartClone & FSArchiver.
 
Old 04-25-2024, 01:39 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,899

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
what do you mean by hidden/system file? What OS and filesystem is it?
 
Old 04-25-2024, 10:25 AM   #8
JASlinux
Member
 
Registered: Oct 2020
Posts: 380

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by wpeckham View Post
Have you looked into PARTCLONE or FSARCHIVER?
Do you lean towards one or the other?

I see PartClone is part of Clonezilla & Wikipedia reads FSArchiver has a Windows version, but otherwise no obvious standout.
 
Old 04-25-2024, 10:26 AM   #9
JASlinux
Member
 
Registered: Oct 2020
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
what do you mean by hidden/system file? What OS and filesystem is it?
If you don't need Windows, consider yourself blessed.
 
Old 04-25-2024, 02:54 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
TAR

Normally you'd move the files to be contiguous. Then you'd Zero out free space.

One can actually use windows backup feature on a hidden partition if they unhide it.

If you have a way to attach a WD drive they offer a free Acronis version that works great. Attach can be isci I think too.

Clonezilla is normally a file by file clone if it can read the filesystem.
 
Old 04-25-2024, 07:21 PM   #11
mw.decavia
Member
 
Registered: Feb 2024
Distribution: Slackware64-15 & Afterstep , oh my
Posts: 80

Rep: Reputation: 9
I am just curious. What sort of error do you get from a command like this?

Code:
dd if=/dev/sda1 bs=1M skip=0 count=100 | gzip -c > test.bin.gz
Quote:
Originally Posted by JASlinux View Post
I am attempting to archive a 240G internal SSD.

In the past I've experience difficulties using dd with command line compression, speed & I/O errors.

Anyone using an alternative Linux utility for backup images of only used partition space (currently < 40GB)?
 
Old 04-26-2024, 12:14 AM   #12
JASlinux
Member
 
Registered: Oct 2020
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by mw.decavia View Post
I am just curious. What sort of error do you get from a command like this?

Code:
dd if=/dev/sda1 bs=1M skip=0 count=100 | gzip -c > test.bin.gz
If it were recent I could tell you. I remember a lot of frustration, vaguely recalling it could have been the file system (NTFS). It was also very slow (I use old computers).

What if we had room to clone the whole disk then split the .img before compressing each chunk after? I mull the possibilities.

I also need to learn why defragmenting is "trimming" the disk instead of the old graphical read/write routine. If it works the partition could be shrunk to used + required space.
 
Old 04-26-2024, 12:28 AM   #13
JASlinux
Member
 
Registered: Oct 2020
Posts: 380

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
TAR

Normally you'd move the files to be contiguous. Then you'd Zero out free space.
I know what that means about not why it is a suggestion. If you .tar'd a partition that could be an archive if accurately replicated, not having to worry about what else is on a source disk.

Quote:
One can actually use windows backup feature on a hidden partition if they unhide it.
Windows has a default system backup I use, but I need a Linux version.

Quote:
If you have a way to attach a WD drive they offer a free Acronis version that works great. Attach can be isci I think too.
If you can download it as owner of a drive that sounds good.

Quote:
Clonezilla is normally a file by file clone if it can read the filesystem.
Again, the goal is to skip the unused space, split into manageable chunks, & ideally compress, but maybe not all in one step if done manually.
 
Old 04-26-2024, 12:41 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,899

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
And the question is again, what have you tried, what went wrong? What do you want to achieve?
If you have windows/ntfs better to use windows based tools to make backups.
Why do you need linux at all?
Zeroing the free space has a "side effect": you can easily backup the whole partition without storing all of those the zeroes (called sparse file).
But anyway, as far as I see you want to backup files, and you have a solution already. It will automatically skip free space. Tar can make an archive like that, including splitting and compressing too.
If you have I/O errors you need to fix them first, but it looks like it is not important. Copying 240GB may take some time, and there is no tool to overcome hardware limitations (if any).
 
Old 04-26-2024, 09:16 AM   #15
mw.decavia
Member
 
Registered: Feb 2024
Distribution: Slackware64-15 & Afterstep , oh my
Posts: 80

Rep: Reputation: 9
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.

Quote:
Originally Posted by JASlinux View Post
If it were recent I could tell you. I remember a lot of frustration, vaguely recalling it could have been the file system (NTFS). It was also very slow (I use old computers).

What if we had room to clone the whole disk then split the .img before compressing each chunk after? I mull the possibilities.

I also need to learn why defragmenting is "trimming" the disk instead of the old graphical read/write routine. If it works the partition could be shrunk to used + required space.
 
  


Reply

Tags
archives, backup, dd



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
[SOLVED] Bash case-esac alternatives and optimization for empty and set variable combinations rwyarbrough Programming 9 10-31-2018 03:12 PM
[SOLVED] update-alternatives: error: unable to read link `/etc/alternatives/editor': Invalid a ccc Debian 1 12-16-2013 01:51 AM
[SOLVED] Technique - alternatives to tell if directory empty or not grail Programming 15 07-27-2011 07:37 PM
Gentoo VNC, empty dialog box !! "Question" window is empty ! TheHushedCaskeT Linux - Software 0 02-01-2005 10:14 PM
FC2 test 3 mouse skipping a beat, movie skipping also jang Fedora 1 10-28-2004 07:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:17 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
Open Source Consulting | Domain Registration