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 |
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-16-2016, 01:15 PM
|
#1
|
LQ Newbie
Registered: Oct 2016
Posts: 6
Rep:
|
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
|
|
|
10-17-2016, 09:50 AM
|
#2
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,915
|
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: - 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
|
|
2 members found this post helpful.
|
10-17-2016, 10:00 AM
|
#3
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797
|
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.
|
10-17-2016, 12:13 PM
|
#4
|
LQ Newbie
Registered: Oct 2016
Posts: 6
Original Poster
Rep:
|
Thanks it copied fine. But as you said the partion is now 30g smaller. So I can fix this without losing data with gparted
|
|
|
10-17-2016, 01:21 PM
|
#5
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,915
|
Quote:
Originally Posted by 20GT
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.
|
10-17-2016, 04:11 PM
|
#6
|
LQ Newbie
Registered: Oct 2016
Posts: 6
Original Poster
Rep:
|
this is what it Looks like
Id like to reclaim 27G
|
|
|
10-17-2016, 04:32 PM
|
#7
|
Moderator
Registered: Mar 2008
Posts: 22,182
|
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.
|
|
|
10-17-2016, 06:04 PM
|
#8
|
LQ Newbie
Registered: Oct 2016
Posts: 6
Original Poster
Rep:
|
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
|
|
|
10-17-2016, 06:18 PM
|
#9
|
LQ Newbie
Registered: Oct 2016
Posts: 6
Original Poster
Rep:
|
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.
|
|
|
10-17-2016, 07:50 PM
|
#10
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,619
|
use mount command without arguments to verify, eg type 'mount' in a terminal
|
|
|
10-17-2016, 08:38 PM
|
#11
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797
|
Quote:
Originally Posted by 20GT
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.
|
10-17-2016, 08:44 PM
|
#12
|
LQ Newbie
Registered: Oct 2016
Posts: 6
Original Poster
Rep:
|
thanks Everyone I figured it out
|
|
|
All times are GMT -5. The time now is 06:11 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
|
|