LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-24-2015, 03:00 PM   #1
JoeHesse
LQ Newbie
 
Registered: Oct 2015
Posts: 2

Rep: Reputation: Disabled
Question on dd comand


I want to back up my wife's entire Win 8 hard drive so it can be restored if she doesn't like Win 10. I don't want the back up to be bootable, I just want to be able to restore to her hard drive.

I intend to boot her computer with a Linux CD and do:

# dd if=/dev/sda of=/dev/sdb

My question is: does sdb have to be formatted or can an empty drive with no MBR and no partitions be used?

Can I back up her hard drive to a formatted partition on sdb? For example, can I do:
# dd if=/dev/sda of=/dev/sdb1

Thank you,
Joe
 
Old 10-24-2015, 03:22 PM   #2
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 840

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by JoeHesse View Post
I intend to boot her computer with a Linux CD and do:

# dd if=/dev/sda of=/dev/sdb

My question is: does sdb have to be formatted or can an empty drive with no MBR and no partitions be used?
No. The above command will copy everything from sda to sdb, preserving the layout of the data and partitions, and including the unused space on sda, destroying any data and partitions on sdb.

Quote:
Originally Posted by JoeHesse View Post
Can I back up her hard drive to a formatted partition on sdb? For example, can I do:
# dd if=/dev/sda of=/dev/sdb1
Thank you,
Joe
This would destroy the filesystem on sdb1. But you can (assuming you mount sdb1 to say, /mnt/disk)

Code:
mount /dev/sdb1 /mnt/disk
dd if=/dev/sda of=/mnt/disk/sda_image
it will copy sda to a file on sdb1, assuming sdb1 can hold a file that large.
Also, I would recommend to use the "bs" option for dd to copy at least a few kilobytes or megabytes at a time to speed up the process.
 
Old 10-24-2015, 06:53 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,383

Rep: Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199Reputation: 2199
The normal way is to use Windows tools.

You are going to get into trouble with a dd command I'd think.
 
Old 10-24-2015, 08:03 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
Quote:
Originally Posted by jefro View Post
The normal way is to use Windows tools.

You are going to get into trouble with a dd command I'd think.
dd does an exact copy of the entire disk. You can't get a more accurate copy, this will work without any problems.
 
Old 10-24-2015, 08:12 PM   #5
qlue
Member
 
Registered: Aug 2009
Location: Umzinto, South Africa
Distribution: Crunchbangified Debian 8 (Jessie)
Posts: 747
Blog Entries: 1

Rep: Reputation: 172Reputation: 172
I have used dd in a similar way to preserve small drives like the SSD on a netbook. (8GiB)
I would not recommend using dd to bit copy a drive larger than 64GiB for two reasons;
1.) You need a receiving drive with either the exact amount of available space or much more space than the drive you're copying.
2.) It takes forever!

Furthermore, When I upgraded to Windows 10 the first time, Microsoft provided a roll-back option that's available for thirty days after the upgrade. I may be wrong, but I think this is available as a standard feature of the upgrade.

P.S: the dd command I use to make a 'backup' of a drive is;
Code:
sudo dd if=/dev/sda of=drive.img bs=1M
In order for this to work, you have to navigate to the directory where you want the backup file saved and /dev/sda must not be in use at all. (so boot from a liveCD to do this)
To reverse it, just swap the if= and of= but beware that everything in the of= path will be overwritten and stopping it once you start won't save your data. (it starts overwriting immediately. Hence the nickname "Data Destroyer")
 
Old 10-24-2015, 10:50 PM   #6
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 1,687

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
Rather than dd, consider a cloning tool like Clonezilla. Advantages: Allows copying to various targets including network, allows compression of the backup and thereby saving a lot of space.
 
Old 10-25-2015, 01:00 AM   #7
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 262

Rep: Reputation: 5
I have used dd in this fashion before. It will make an identical copy, even making the drive bootable and such.

It's actually a good way to make a backup of an important system (at least I think so) since it lets you make an identical drive in case the worst possible scenario happens.

And yes, you do need a drive of the same size.
 
Old 10-26-2015, 02:00 PM   #8
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,324
Blog Entries: 1

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
If you're going to restore it to the same drive, then dd will work. If you want it to be bootable on a different drive you'll have issues. More issues if the other drive isn't the same size and stuff. For the initial backup you should use a FILE, not the entire disk. But you'll need a filesystem able to hold that size of file. And a drive big enough to hold it and probably multiple copies of it.

backup
# dcfldd if=/dev/sda of=/mnt/drive/directory/backup_20151026.dd bs=1M

restore
# dcfldd if=/mnt/drive/directory/backup_20151026.dd of=/dev/sda bs=1M

Where dcfldd is a variant of dd that gives feedback about it's progress. Explore multiple images of the backup with various tools as you might have issues and having options is always good. Better safe than left with only windows 10 as your alternative OS.
 
Old 10-26-2015, 02:28 PM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
heres my recommendation:
http://www.linuxquestions.org/questi...9/#post5408615
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
timex - what does this comand mean? rust8y Solaris / OpenSolaris 3 01-31-2012 08:11 PM
Question on dd comand. just.srad Linux - General 3 05-02-2008 08:23 PM
mailx comand ajatiti Linux - Enterprise 2 03-27-2008 11:15 AM
Problem is using the comand 'c' ssda Linux - Networking 0 11-09-2006 08:24 AM
Help w/comand line dolvmin Linux - Software 2 09-23-2003 05:28 PM


All times are GMT -5. The time now is 08:33 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration