[SOLVED]How do you image a disk with Linux/Debian? (dd dead)

New to Debian (Or Linux in general)? Ask your questions here!

[SOLVED]How do you image a disk with Linux/Debian? (dd dead)

Postby Chiefahol2 » 2018-05-04 22:52

Hello.

I just want to copy /dev/sda to a file like sda.raw, just in case i want to roll back my installation.

DD seems to not be capable of performing this task, i have been trying for about 5 days now with every combination of distro/desktop you can imagine. DD causes 100% of the systems i try to freeze, it freezes KDE, it freezes GNOME, it freezes every kind of live disk you can imagine. This is basically the command i've been trying:

$ sudo ionice -c3 dd if=/dev/sda of=./sda.raw status=progress

^ This command fails 100% of the time and freezes seemingly every modern linux system, even though ionice is supposed to prevent this. :evil:

Both the SSD i'm trying to image and the HDD i'm copying it to are in good health with 0 reallocated sectors, so it's not a hardware issue.

How else can i just make a block for block copy of sda? Without using dd?

Solution: Persistent and live usbs has some I/O issue with imaging SSDs, it also seems the disk i was trying to image to was not in the best health, solution was so use another system installed on an ssd (i imagine a hdd would work too), no issue using dd or cp after this.
Last edited by Chiefahol2 on 2018-05-07 06:15, edited 1 time in total.
User avatar
Chiefahol2
 
Posts: 38
Joined: 2016-08-06 22:49

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby Dai_trying » 2018-05-05 06:24

I think your of could be wrong, I just tried with a small usb stick and this is the command that worked without issue for me
Code: Select all
sudo ionice -c3 dd if=/dev/sdb of=sda.raw status=progress

This will write the file to the current directory so be sure to place it where you want it, I thought it strange that your of has a full stop (period) at the beginning as I have never seen it used in that way, I know it usually means current directory but just haven't seen it that way before, anyway I hope this helps.

btw I was not aware of the status=progress option with dd until this post, so thanks for that. :)
Dai_trying
 
Posts: 422
Joined: 2016-01-07 12:25

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby Ardouos » 2018-05-05 08:29

CloneZilla is a great live tool to clone/image computers. It can use numerous tools to backup a system (partclone, dd etc...).
User avatar
Ardouos
 
Posts: 986
Joined: 2013-11-03 00:30
Location: Elicoor II

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby p.H » 2018-05-05 08:54

1) dd uses a default block size of 512 bytes, which slows down the copy. You should set a bigger block size with the bs option, at least 4 KiB (4k). Alternatively, you can use cp which uses a block size of 128 KiB.

2) The source device must not be used in read-write mode during the copy, otherwise the image may be corrupted.

3) Where are you writing the destination image ?
p.H
 
Posts: 372
Joined: 2017-09-17 07:12

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby Chiefahol2 » 2018-05-05 13:06

p.H wrote:1) dd uses a default block size of 512 bytes, which slows down the copy. You should set a bigger block size with the bs option, at least 4 KiB (4k). Alternatively, you can use cp which uses a block size of 128 KiB.


Tried with 8KB and it froze in the exact same way, tried with cp command and it failed in the exact same way. (Whole system freezes and i can hear the disk not being written too anymore.) From where I'm standing most of the oldest GNU-utils seems to be completely broken. :x

2) The source device must not be used in read-write mode during the copy, otherwise the image may be corrupted.


The device isn't even mounted.

3) Where are you writing the destination image ?


To a regular 2TB HDD (Which has reported no bad sectors yet.) with a single Ext4 filesystem on it. Connected by a USB-HDD dock.
User avatar
Chiefahol2
 
Posts: 38
Joined: 2016-08-06 22:49

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby Chiefahol2 » 2018-05-05 13:10

Dai_trying wrote:I think your of could be wrong, I just tried with a small usb stick and this is the command that worked without issue for me
Code: Select all
sudo ionice -c3 dd if=/dev/sdb of=sda.raw status=progress

This will write the file to the current directory so be sure to place it where you want it, I thought it strange that your of has a full stop (period) at the beginning as I have never seen it used in that way, I know it usually means current directory but just haven't seen it that way before, anyway I hope this helps.


Error occurs either way. :( Even with cp command.
User avatar
Chiefahol2
 
Posts: 38
Joined: 2016-08-06 22:49

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby Chiefahol2 » 2018-05-05 13:11

Ardouos wrote:CloneZilla is a great live tool to clone/image computers. It can use numerous tools to backup a system (partclone, dd etc...).


You think id be able to mount my HDD on clonezilla and image my ssd to a file on it? Without it failing 100% of the time? :oops:

From the clonezilla site:

Clonezilla Live can be used to image or clone individual computers using a CD/DVD or USB flash drive. Though the image size is limited by the boot media's storage capacity


Uhh does this mean i need to put clonezilla on a larger disk than the one being imaged? :(
User avatar
Chiefahol2
 
Posts: 38
Joined: 2016-08-06 22:49

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby sgage » 2018-05-05 15:06

" From where I'm standing most of the oldest GNU-utils seems to be completely broken. "

The oldest GNU-utils, while simple, generally do what they are supposed to without fail. They have been debugged for years, if not decades. I think you've got something else going on.

I, and millions of others, use the dd command to do exactly what you are attempting, and have been for many years, on many different hardware configurations, without fail. I think you ought to consider slowing down and doing some more thinking and less lashing out, which is what it really seems like. From where I'm standing. :)
sgage
 
Posts: 32
Joined: 2013-03-10 21:00

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby Dai_trying » 2018-05-05 16:16

Chiefahol2 wrote:
Dai_trying wrote:I think your of could be wrong, I just tried with a small usb stick and this is the command that worked without issue for me
Code: Select all
sudo ionice -c3 dd if=/dev/sdb of=sda.raw status=progress

This will write the file to the current directory so be sure to place it where you want it, I thought it strange that your of has a full stop (period) at the beginning as I have never seen it used in that way, I know it usually means current directory but just haven't seen it that way before, anyway I hope this helps.


Error occurs either way. :( Even with cp command.


The command I posted worked for me, maybe you have another problem with the system which is having this effect??
Dai_trying
 
Posts: 422
Joined: 2016-01-07 12:25

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby julian516 » 2018-05-05 19:36

I just recently had to clone my C: windows disk, which had grown too small. I had no trouble doing that at all with Clonezilla. Note that C-zilla will either clone a disk or create a disk image, as you choose. I strongly recommend it. There are a number of good tutorials that will show you how to set up what you want to do. The new disk you are using does not have to be larger than your existing disk but it cannot be smaller, at least as I understand it. Give it a try. C-zilla is a good tool.
julian516
 
Posts: 311
Joined: 2010-03-18 20:10
Location: Loveland, CO

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby llivv » 2018-05-05 21:50

dd cp and ionice are all broken - hummm

looks like you've run those commands described enough times to see where the freeze happens - yes

work around the freeze
that should give you a clue about what is broken.
in the kitchen with Julia ....
The Past, Christmas Present and Future
Get it on the Dbus to Bcan
User avatar
llivv
 
Posts: 5623
Joined: 2007-02-14 18:10
Location: willo the tree

Re: How do you image a disk with Linux/Debian? (dd is broken

Postby pcalvert » 2018-05-06 20:43

I usually don't use dd unless I am backing up the MBR or MBR plus the partition table. What I do is backup the individual partitions using partclone. And sometimes I use ddrescue. Although ddrescue is a data recovery tool, there's no reason you can't use it to image good storage media.

Here's a good help page for ddrescue:
http://www.forensicswiki.org/wiki/Ddrescue

Phil
“Property is the fruit of labor; property is desirable; it is a positive good
in the world. That some should be rich shows that others may become
rich, and hence is just encouragement to industry and enterprise.”
— Abraham Lincoln
pcalvert
 
Posts: 1774
Joined: 2006-04-21 11:19
Location: Sol Sector

Re: [SOLVED]How do you image a disk with Linux/Debian? (dd d

Postby Chiefahol2 » 2018-05-07 06:17

Solution was use another system installed on an ssd, the usb systems all seemed to cark it when trying to image a large disk. HDD i was trying to image too is aging as well.
User avatar
Chiefahol2
 
Posts: 38
Joined: 2016-08-06 22:49


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable