LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-16-2016, 12:15 PM   #1
20GT
LQ Newbie
 
Registered: Oct 2016
Posts: 6

Rep: Reputation: Disabled
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.

Is that going to matter when using dd?

my full hardware profile


original drive
Code:
id:	scsi:0
physical id:	1
logical name:	scsi0
capabilities:	emulated
**********
id:	disk
description:	ATA Disk
product:	HDS728080PLAT20
physical id:	0.0.0
bus info:	scsi (at)0:0.0.0
logical name:	/dev/sda
version:	A27A
serial:	PFD8T5SXRBY6VX
size:	74GiB (80GB)
capabilities:	partitioned partitioned:dos
configuration:	
ansiversion	=	5
logicalsectorsize	=	512
sectorsize	=	512
signature	=	54eda6e3

destination drive
Code:
id:	scsi:1
physical id:	2
logical name:	scsi2
capabilities:	emulated
**********
id:	disk
description:	ATA Disk
product:	SanDisk SDSSDA12
physical id:	0.0.0
bus info:	
scsi (at)2:0.0.0
logical name:	/dev/sdb
version:	80RL
serial:	163602453113
size:	111GiB (120GB)
configuration:	
ansiversion	=	5
logicalsectorsize	=	512
sectorsize	=	512
 
Old 10-17-2016, 08:50 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,266
Blog Entries: 12

Rep: Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862
Hi and Welcome to LQ!

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:
  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. ONCE AGAIN BE CAREFUL AND DOUBLE CHECK BEFORE YOU HIT RETURN TO MAKE SURE YOU HAVE THE COMMAND CORRECTLY SPECIFIED
 
2 members found this post helpful.
Old 10-17-2016, 09:00 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,437

Rep: Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507
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.
 
1 members found this post helpful.
Old 10-17-2016, 11:13 AM   #4
20GT
LQ Newbie
 
Registered: Oct 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks it copied fine. But as you said the partion is now 30g smaller. So I can fix this without losing data with gparted
 
Old 10-17-2016, 12:21 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,266
Blog Entries: 12

Rep: Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862Reputation: 1862
Quote:
Originally Posted by 20GT View Post
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.
 
1 members found this post helpful.
Old 10-17-2016, 03:11 PM   #6
20GT
LQ Newbie
 
Registered: Oct 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
this is what it Looks like
Id like to reclaim 27G
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	12
Size:	49.1 KB
ID:	23312  
 
Old 10-17-2016, 03:32 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,500

Rep: Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413
You can run a live media and use a tool like gparted to either add a new partition or move swap and expand the existing partition lower to fill space.
 
Old 10-17-2016, 05:04 PM   #8
20GT
LQ Newbie
 
Registered: Oct 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
Im on live disk running gparted
I see the swap partition. when its selected Move is greyed out
it only has
Swap off
Manage Flags
Information
 
Old 10-17-2016, 05:18 PM   #9
20GT
LQ Newbie
 
Registered: Oct 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
http://blog.mwpreston.net/2012/06/22...ut-of-the-way/

says

Quote:
First, resize your extended partition (not the one labeled linux-swap) to include the free space. In my case this is done by selecting /dev/sdb2 and then selecting the Resize/Move button.
With extended partition selected, Move is grayed out, only Manage Flags and Information are available

information on that partition says
my extended partition status says: Busy (At least one logical partition is mounted)

Last edited by 20GT; 10-17-2016 at 05:20 PM.
 
Old 10-17-2016, 06:50 PM   #10
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,388

Rep: Reputation: 408Reputation: 408Reputation: 408Reputation: 408Reputation: 408
use mount command without arguments to verify, eg type 'mount' in a terminal
 
Old 10-17-2016, 07:38 PM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,437

Rep: Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507Reputation: 1507
Quote:
Originally Posted by 20GT View Post
Im on live disk running gparted
I see the swap partition. when its selected Move is greyed out
it only has
Swap off
Manage Flags
Information
Your live disk must be using the swap partition. Select "Swap off", then you should be able to delete the swap partition and continue.
 
1 members found this post helpful.
Old 10-17-2016, 07:44 PM   #12
20GT
LQ Newbie
 
Registered: Oct 2016
Posts: 6

Original Poster
Rep: Reputation: Disabled
thanks Everyone I figured it out
Attached Thumbnails
Click image for larger version

Name:	Workspace 1_005.png
Views:	7
Size:	51.1 KB
ID:	23315  
 
  


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
drag-drop copying and cp command both hang at last few KB when copying to flash drive slacker_ Linux - Newbie 1 09-05-2013 07:17 AM
dd copy; destination drive size wheelsg Linux - Hardware 5 11-11-2008 12:21 PM
Copying files from internal Hard drive to USB 2.0 Hard Drive is NOT Behaving tubatodd Ubuntu 4 02-19-2007 04:32 PM
Needing help copying large hard drive to smaller drive sdubble Linux - Software 1 02-21-2006 12:06 PM


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