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-16-2016, 01: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, 09:50 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,915
Blog Entries: 13

Rep: Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948
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, 10:00 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
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, 12:13 PM   #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, 01:21 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,915
Blog Entries: 13

Rep: Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948Reputation: 4948
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, 04: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:	18
Size:	49.1 KB
ID:	23312  
 
Old 10-17-2016, 04:32 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,182

Rep: Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646Reputation: 3646
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, 06: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, 06: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 06:20 PM.
 
Old 10-17-2016, 07:50 PM   #10
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,619

Rep: Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890Reputation: 890
use mount command without arguments to verify, eg type 'mount' in a terminal
 
Old 10-17-2016, 08:38 PM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
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, 08: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:	14
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 08:17 AM
dd copy; destination drive size wheelsg Linux - Hardware 5 11-11-2008 01:21 PM
Copying files from internal Hard drive to USB 2.0 Hard Drive is NOT Behaving tubatodd Ubuntu 4 02-19-2007 05:32 PM
Needing help copying large hard drive to smaller drive sdubble Linux - Software 1 02-21-2006 01:06 PM

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

All times are GMT -5. The time now is 06:11 PM.

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