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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-25-2019, 07:37 PM
|
#1
|
Senior Member
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 22.04
Posts: 2,169
Rep:
|
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.
|
|
|
10-25-2019, 08:46 PM
|
#2
|
LQ Guru
Registered: Oct 2004
Distribution: Arch
Posts: 5,470
|
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%
|
|
|
10-25-2019, 08:56 PM
|
#3
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,418
|
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.
|
|
|
10-25-2019, 09:22 PM
|
#4
|
Moderator
Registered: Mar 2008
Posts: 22,361
|
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.
|
|
|
10-25-2019, 09:24 PM
|
#5
|
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,987
|
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.
|
|
|
10-26-2019, 07:19 AM
|
#6
|
LQ Guru
Registered: Oct 2004
Distribution: Arch
Posts: 5,470
|
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.
|
|
|
All times are GMT -5. The time now is 03:53 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|