LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-31-2012, 04:33 AM   #1
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Smile dd to clone server


hi guys, if i want to clone my server to an external hard drive and i type this command:
df -h

and it has this output:
File System Mounted on
/dev/sda3 /

so /dev/sda3 is the correct one to be the input for the dd command?

so if let's say my external drive is /dev/sda5

so my command will be: dd if=/dev/sda3 of=/dev/sda5

please help guys, whether that will be the correct method.

thanks for any help
 
Old 08-31-2012, 05:18 AM   #2
centos123
Member
 
Registered: Apr 2011
Posts: 397

Rep: Reputation: 16
server hard disk /dev/sdb external hard disk /dev/sda

bindas run this command it will clone it..

dd if=/dev/sdb of/dev/sda bs=4096

i created 10 times with this command ...have fun..
 
1 members found this post helpful.
Old 08-31-2012, 07:38 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by JJJCR View Post
dd if=/dev/sda3 of=/dev/sda5
With this you'll be copying one partition to another partition on the same disk. Run 'fdisk -l' as root to show you what disks and partitions are available to you. Also if the size of your target partition is smaller than your source partition then you may overwrite more than the target partition if there is another partition behind it instead of free space or the process may halt if it's the last partition on the disk without any free space left after it.
*The command centos123 showed you clones a whole disk. This may be easier if you've got two similarly sized disks and the target disk doesn't hold anything you'd want to keep anyway.
 
1 members found this post helpful.
Old 08-31-2012, 11:32 PM   #4
centos123
Member
 
Registered: Apr 2011
Posts: 397

Rep: Reputation: 16
unspan had wrote true...command i given is to clone whole disk.
but one thing you should remember your cloned disk will boot only in those pc whose configuration is same as source pc/server..

means you should have both machine hardware configuration same.else it will not boot or create issue or chance to get .corrupt ....
 
1 members found this post helpful.
Old 09-01-2012, 01:52 AM   #5
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
I wonder but I think it's safer if you just copy the files with 'cp -a' with /dev/sda3 mounted somewhere as well other than root like /mnt/system. It probably defragments your files as well
 
1 members found this post helpful.
Old 09-11-2012, 06:11 PM   #6
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by unSpawn View Post
Also if the size of your target partition is smaller than your source partition then you may overwrite more than the target partition if there is another partition behind it instead of free space or the process may halt if it's the last partition on the disk without any free space left after it.
This I don't observe. If I:
Code:
# dd if=/dev/zero of=/dev/sda1
I will get at one point no space left. And the remaining partitions are still intact.
 
Old 09-11-2012, 06:23 PM   #7
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by konsolebox View Post
I wonder but I think it's safer if you just copy the files with 'cp -a' with /dev/sda3 mounted somewhere as well other than root like /mnt/system. It probably defragments your files as well
Well, since the sda3 partition was the root file system, a cp would (try to) copy some (logically) infinite files (/dev/null, /dev/zero, /dev/random, etc.) to the other partition. Unless you have an unlimited partition size, and can wait for the enegery death of the universe, this may not be a wise thing to do. Even a bind mount of an active root partition would, I believe, not help.

For the O.P., consider a Google of clonezilla.

Last edited by PTrenholme; 09-11-2012 at 06:27 PM.
 
Old 09-11-2012, 08:54 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
If you just want a partition then you could even try things like gparted. Sda3 or such is a partition and not a clone of an OS as such.

Also partimage was used a lot. Clonezilla is as suggested a choice. +
 
Old 09-11-2012, 09:33 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Reuti View Post
This I don't observe.
Thanks for the correction.
 
Old 09-12-2012, 12:31 AM   #10
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by PTrenholme View Post
Well, since the sda3 partition was the root file system, a cp would (try to) copy some (logically) infinite files (/dev/null, /dev/zero, /dev/random, etc.) to the other partition. Unless you have an unlimited partition size, and can wait for the enegery death of the universe, this may not be a wise thing to do. Even a bind mount of an active root partition would, I believe, not help.

For the O.P., consider a Google of clonezilla.
The last time I did that (mounted in /mnt/system), I don't think it does. Perhaps if you do it with root where /dev is mounted, but not on /mnt/system.

Or maybe it doesn't always work. I did it a long time ago when I dup'ed my system to try building new packages.

Update: I just tried again and it does work. I tried copying the dev directory from there.

Last edited by konsolebox; 09-12-2012 at 12:42 AM.
 
  


Reply



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
How to clone a user account from one server to other server ZAMO Linux - Enterprise 5 03-19-2010 01:40 AM
I need to Clone a Red Hat drive and install clone in HP server drummer54 Linux - Newbie 14 03-07-2009 04:15 PM
trying to clone virtual server braclayrab Linux - Newbie 1 11-19-2008 09:59 AM
Clone HD to another server nnhubbard Linux - Newbie 6 11-18-2008 02:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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