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-08-2018, 12:10 PM   #1
mikerea
LQ Newbie
 
Registered: Oct 2018
Posts: 4

Rep: Reputation: Disabled
Question Using dd to completely copy a hard drive?


Hi!

I'm relatively new to Linux, and at work I've been tasked with figuring out how to transition from using a laptop Linux Mint machine to a desktop machine. A lot of installs and settings were set before I was brought onto the project, so I'm not sure if I'd be able to completely restore the computer from scratch when we get our desktop.

I've found a terminal command, dd, that I understand can allow me to make an image of the hard drive. In theory, could I use this to create an image of the entire laptop hard drive, every bit included, copy it to an external drive, and then move that into the internal drive of the desktop tower? If that's possible, would that get the desktop to just act as a more powerful version of the laptop (assuming better hardware)? Or are there any additional steps I'd need to take?

Thanks so much!!

Last edited by mikerea; 10-08-2018 at 12:13 PM. Reason: clarity on OS
 
Old 10-08-2018, 01:01 PM   #2
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: AntiX 17
Posts: 5,822
Blog Entries: 21

Rep: Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900
You should be OK. But dd requires double and triple checking for me.

Here is my search results for Linux Mint : Linkhttps://www.google.com/search?q=copy...w=1366&bih=590
 
Old 10-08-2018, 01:02 PM   #3
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,110
Blog Entries: 3

Rep: Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000
I'd just move the data and the configurations onto a fresh install.
 
Old 10-08-2018, 01:06 PM   #4
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: AntiX 17
Posts: 5,822
Blog Entries: 21

Rep: Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900Reputation: 2900
Just so you know. I have pulled hard drives out of broken laptops of mine. Then installed them in a newer laptop. I just reconfigure wlan0 wireless interface and connect that drive to the internet .

Everything else works well out of the box. The kernel handles it . So. You can just buy a small caddy and tell your desktop computer to boot that laptop drive < Using your bios >

Just mentioning this in case you did not know.
 
1 members found this post helpful.
Old 10-08-2018, 01:08 PM   #5
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,630

Rep: Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204Reputation: 1204
Quote:
Originally Posted by Turbocapitalist View Post
I'd just move the data and the configurations onto a fresh install.
Agreed. There will be things* on the drive specific to the hardware in the laptop that may not work on the desktop.

(* A technical term I don't know exactly what, but I've had problems moving a hard drive from one desktop to another that I didn't have the skills to resolve)
 
Old 10-08-2018, 01:33 PM   #6
fatmac
Senior Member
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Posts: 3,093

Rep: Reputation: Disabled
Just make a copy of your personal data files, so that you can copy them over to a fresh installation on your new desktop.

If there is any special configuration, copy that as well, (if you use Firefox, make a copy of your .mozilla directory too, saves a lot of typing if you use it on your new system).
 
Old 10-08-2018, 01:41 PM   #7
mikerea
LQ Newbie
 
Registered: Oct 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by fatmac View Post
Just make a copy of your personal data files, so that you can copy them over to a fresh installation on your new desktop.

If there is any special configuration, copy that as well, (if you use Firefox, make a copy of your .mozilla directory too, saves a lot of typing if you use it on your new system).
Would those personal files be my files in ~/dev?

Thanks everyone for the suggestions!
 
Old 10-08-2018, 01:46 PM   #8
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,110
Blog Entries: 3

Rep: Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000Reputation: 2000
I'd say grab the contents of /etc/ /var/ /home/ using tar or rsync and make an inventory of the installed applications:

Code:
dpkg --get-selections > installed.packages.txt
After restoring /etc/ /var/ and /home/ you can carry that text file over to the new computer. Then install from the list:

Code:
sudo dpkg --set-selections < installed.packages.txt
sudo apt-get update
sudo apt-get dselect-upgrade
 
Old 10-08-2018, 01:48 PM   #9
mikerea
LQ Newbie
 
Registered: Oct 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
I'd say grab the contents of /etc/ /var/ /home/ using tar or rsync and make an inventory of the installed applications:

Code:
dpkg --get-selections > installed.packages.txt
After restoring /etc/ /var/ and /home/ you can carry that text file over to the new computer. Then install from the list:

Code:
sudo dpkg --set-selections < installed.packages.txt
sudo apt-get update
sudo apt-get dselect-upgrade
That seems pretty smooth. I'll try that out when I get the hardware! Thank you!
 
Old 10-08-2018, 01:49 PM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,003
Blog Entries: 13

Rep: Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446
Welcome mikerea,

It's worth a try to do the copy. A suggestion is to obtain a live boot copy of Mint to boot from to perform your copy operation and double/triple check the drive letters you are using to perform your copy. Using the correct source and destination, you can do this multiple times. If you do it incorrectly, as in, in reverse? Big problems, including loss of data.

After all, the OS is supposed to start up agnostic to the environment, and learn the environment from BIOS.

There may have been drivers installed for the hardware for the laptop, but likewise there may be drivers that need to be installed for any special hardware on the desktop.

Worst case if you still have the original copy on the laptop and likely the disk image, so you can do the full install route and then copy over settings and install parallel software after a full install on the desktop if the copy method doesn't work as well as you'd like it to.

The big question I have is "What version of Mint is on the laptop?"

My point being that if is old, then I'd recommend installing a new distribution of Mint.

Please update forum members as to the direction you choose and we'll be happy to help you as you progress with your efforts.

If you choose to attempt the copy, you may wish to do the live boot I suggested, and post an output of "fdisk -l" to this thread for people to review and help you form the command correctly. It's not hard, but getting it wrong is an easy mistake.
 
Old 10-08-2018, 01:56 PM   #11
mikerea
LQ Newbie
 
Registered: Oct 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
Welcome mikerea,

It's worth a try to do the copy. A suggestion is to obtain a live boot copy of Mint to boot from to perform your copy operation and double/triple check the drive letters you are using to perform your copy. Using the correct source and destination, you can do this multiple times. If you do it incorrectly, as in, in reverse? Big problems, including loss of data.

After all, the OS is supposed to start up agnostic to the environment, and learn the environment from BIOS.

There may have been drivers installed for the hardware for the laptop, but likewise there may be drivers that need to be installed for any special hardware on the desktop.

Worst case if you still have the original copy on the laptop and likely the disk image, so you can do the full install route and then copy over settings and install parallel software after a full install on the desktop if the copy method doesn't work as well as you'd like it to.

The big question I have is "What version of Mint is on the laptop?"

My point being that if is old, then I'd recommend installing a new distribution of Mint.

Please update forum members as to the direction you choose and we'll be happy to help you as you progress with your efforts.

If you choose to attempt the copy, you may wish to do the live boot I suggested, and post an output of "fdisk -l" to this thread for people to review and help you form the command correctly. It's not hard, but getting it wrong is an easy mistake.
When you say a copy of Mint to boot from, do you mean something outside the laptop? Like a Mint copy on a flash drive? The laptop only has the one drive, so I just want to make sure whether you're saying to boot from that drive, or from a flash drive/external drive.
 
Old 10-08-2018, 02:44 PM   #12
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,003
Blog Entries: 13

Rep: Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446
Yes, exactly. I am saying to download an ISO file for Mint and to burn that to either a DVD or USB thumbstick and boot the laptop off of that.

This is what you call a live media boot.

Doing this, nothing on your laptop hard drive will be in use while you perform the copy operation.

The point here is that it complicates things when you make a copy of an OS drive, that is current operating. If you boot off of another media, like a thumbstick your OS drive is that, and the main drive on your computer is not operating as an OS, but instead it is just a media drive at that point. Far better to copy to avoid any files that are open or not resolved properly because they were in use at the time of the copy.
 
Old 10-08-2018, 02:51 PM   #13
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,003
Blog Entries: 13

Rep: Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446Reputation: 3446
gparted is a graphical tool which also does the same as dd and you may find to be more useful. There also is clonezilla.

Recommend you do a websearch about how to copy a Linux OS drive using dd, gparted, or clonezilla and there should be tons of guides.

And then I'll stress again, "Measure N times, cut copy once!"

If you hadn't heard that one, it's an old adage about construction, or trade work. Measure enough to make sure you're doing it right, then make your cut. Otherwise you may waste a piece of wood, metal, pipe, plastic, etc by cutting it incorrectly. Same applies here.

As you've seen Linux designates drives as /dev/sd<letter>. Well it does that differently for various systems. Make sure you understand which drive letter represents the origin drive and which drive letter represents the destination drive before you issue the command or click "go".
 
  


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
I want to copy my hard drive to a larger hard drive and boot from the new drive. lpmorgan1 Ubuntu 8 09-07-2009 11:26 PM
Completely Formatting My Hard Drive? Novatian Linux - Hardware 8 05-14-2008 11:07 AM
Copy Fedora 5 Hard Drive to another Hard Drive Using Knoppix 5.1.1 lud477 Linux - Software 2 03-17-2007 05:06 PM
How to completely reset the hard drive Systemsy Debian 19 10-07-2005 11:43 PM
Completely copy hard drive... markw8500 Linux - Software 3 08-21-2005 04:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:27 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