Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

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

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
Chiefahol2
Posts: 110
Joined: 2016-08-06 22:49

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

#1 Post by Chiefahol2 »

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.

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

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

#2 Post by Dai_trying »

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. :)

User avatar
Ardouos
Posts: 1075
Joined: 2013-11-03 00:30
Location: Elicoor II
Has thanked: 1 time
Been thanked: 4 times

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

#3 Post by Ardouos »

CloneZilla is a great live tool to clone/image computers. It can use numerous tools to backup a system (partclone, dd etc...).
There is only one Debian | Do not break Debian | Stability and Debian | Backports

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

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

#4 Post by p.H »

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 ?

User avatar
Chiefahol2
Posts: 110
Joined: 2016-08-06 22:49

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

#5 Post by Chiefahol2 »

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: 110
Joined: 2016-08-06 22:49

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

#6 Post by Chiefahol2 »

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: 110
Joined: 2016-08-06 22:49

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

#7 Post by Chiefahol2 »

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? :(

sgage
Posts: 86
Joined: 2013-03-10 21:00
Has thanked: 1 time
Been thanked: 2 times

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

#8 Post by sgage »

" 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. :)

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

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

#9 Post by Dai_trying »

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??

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

#10 Post by julian516 »

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.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

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

#11 Post by llivv »

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 memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

pcalvert
Posts: 1939
Joined: 2006-04-21 11:19
Location: Sol Sector
Has thanked: 1 time
Been thanked: 2 times

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

#12 Post by pcalvert »

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
Freespoke is a new search engine that respects user privacy and does not engage in censorship.

User avatar
Chiefahol2
Posts: 110
Joined: 2016-08-06 22:49

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

#13 Post by Chiefahol2 »

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.

Post Reply