LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-25-2019, 07:37 PM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Rep: Reputation: 73
clone a harddrive


I just bought a new Samsung laptop, it is the same as this older one, just better processors, i5 third generation, I'm told.

I use Ubuntu, the latest LTS version. I have my old laptop set up nicely, all the things installed just as I need them. Things I can't even remember installing!

Can I simply clone this hd onto the new computer's hd?

Or is that not a good idea?

If this is advisable, I'm thinking of removing the hd from the new laptop, putting it in my external drive and copying everything.

Maybe with rsync? I use that to fetch files from my webpage.
 
Old 10-25-2019, 08:46 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833
Quote:
Can I simply clone this hd onto the new computer's hd?
Yes.
If the new one is larger, you'll need to move the last partition out to the end of the drive, and then extend the file system to the end.
Quote:
Or is that not a good idea?
I have done it, won't hurt anything. Better to do a fresh install, but clone will work ok.

Example:
Clone it, make sure which is which.
Code:
dd if=/dev/sda of=/dev/sdb bs=1M
Move the last partition to the end of drive
Code:
(parted) resizepart 2 100%
Extend the file system
Code:
resize2fs /dev/sdb2 100%
 
Old 10-25-2019, 08:56 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,141

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
May I demur - dd is absolutely the wrong tool. Allocate some partitions and use rsync as proposed. Best option is to allocate a separate /home partition, then if a fresh install is required, settings aren't lost.
dd has no knowledge of filesystem structure, and if there are any errors will simply clone the errors as well. It has its uses (forensics say), but not a backup tool.
 
Old 10-25-2019, 09:22 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,001

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
Clones tend to work best on exact hardware. A general rule is to fix specific naming before you clone or you may have to adjust it later.

Will it work? Never know till you try. dd is not tech proof. I've been... I mean people have been known to bork that command.


Some folks use clonezilla booted live on each to move the information over network. I'd think that to be easier than remove but ...

Guess you could even use dd over netcat but that is not as safe as rsync over netcat maybe. Plenty of ways to do this. Any could fail..


Clean boot used to be the only pure way according to some distro's.
 
Old 10-25-2019, 09:24 PM   #5
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,351
Blog Entries: 28

Rep: Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147Reputation: 6147
There's also Clonezilla.

I'm inclined to think that a fresh install on the new computer, with a separate /home, then fetching the files for /home with rsync, is likely the best option (I have used a separate /home partition for many years, and have several times been very glad I do).

If it were me, I'd be concerned about potential hardware conflicts in trying to restore a clone from an older machine to the newer one.

Of course, you could try cloning and, if it fails, you would have a fallback plan.
 
Old 10-26-2019, 07:19 AM   #6
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833
Fresh install the best option. Yes definitely. I said so in post 2.

A file system will have bad blocks, bad sectors, errors, corrupt files, sometimes even immovable data. If you clone it, you clone all of that. dd clones.

Quote:
Can I simply clone this hd onto the new computer's hd?
Sure you can. Will it run ok, sure it will, it will be just like that old drive.

Quote:
Or is that not a good idea?
You see what everyone has said.

Is there an advantage to doing it? Sure, no reconfiguring, no installing, no nothing.

I did a 160GB almost full to a 500GB. Whole thing from start to rebooting the new drive was about 35 min. If you are going to do it with a 1TB drive...that's going to take a while.

Also when you run some like:
Code:
tune2fs -l /dev/sda2
It will look the same as the old drive. Because that is what it is.
 
  


Reply



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
Clone and boot from clone geelsu Linux - Server 5 12-17-2018 12:03 PM
LXer: Open-spec SBC is a clone of a clone of a clone of a Raspberry Pi 3 LXer Syndicated Linux News 0 04-25-2018 04:56 PM
Linux 64 bit fresh install, created clone on cd, want to use clone on another laptop... apollo1980 Linux - Software 12 10-12-2017 02:59 PM
I need to Clone a Red Hat drive and install clone in HP server drummer54 Linux - Newbie 14 03-07-2009 04:15 PM
bugzilla: to clone, or not to clone? The00Dustin Linux - Newbie 1 05-24-2008 05:19 AM

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

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