[SOLVED] copying drive using dd - destination drive not seen by OS
Linux - NewbieThis 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!
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.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
copying drive using dd - destination drive not seen by OS
I want to copy one entire drive to another, remove the original drive and boot from the copy. I'm not very knowledgeable about Linux or computers in general. I researched and found that the dd command was probably the way to do it. My OS is Ubuntu16.4LTS. The destination drive doesn't show up as mounted in Ubuntu but it shows in my hardware profile.
To do this, both drives are fine not being mounted and instead you use the entire disk letter, such as: if=/dev/sda and of=/dev/sdb.
Couple of very important things you should know about this whole process:
Copying a system disk this way is valid, however realize that it will copy the entire disk to the destination and then your destination will be a 75G sized partition. You can fix this using something like gparted.
You should not be booted and operating from either of these disks, therefore if sda is your boot disk, then you need to boot off of a live media such as DVD or USB, then verify that you can see the disks as you do in your post. Then it will be safe to do the dd command.
dd will need to be performed by root, and a best way to do this is to use the sudo command, but be fully aware that making an error will potentially be disruptive. if= INPUT of = OUTPUT, if you swap them and start the command incorrectly, you will have corrupted the disk you intend to do, there are no warnings nor protective verification measures when you do this.
Ideal command, given the architecture you've shown would be "sudo dd if=/dev/sda of=/dev/sdb" with optional "bs=12M" if you wish to help it go faster, but leaving out the bs= argument is fully valid and I personally never use that argument much.
ONCE AGAIN BE CAREFUL AND DOUBLE CHECK BEFORE YOU HIT RETURN TO MAKE SURE YOU HAVE THE COMMAND CORRECTLY SPECIFIED
One other issue is that the copying includes filesystem labels and UUIDs. You should not try to boot the system while both drives are connected, since you could find the system running from the "wrong" drive.
Thanks it copied fine. But as you said the partion is now 30g smaller. So I can fix this without losing data with gparted
Yes, and when you run gparted, you also do so using sudo. INCREASING is not so big of a deal and also very common. You'll be able to see the staged information in advance of choosing to execute the final command. Decreasing is more difficult because of fragmentation of data and the necessity to move information around to accomplish the decreasing. However that is not what you're doing.