LinuxQuestions.org
Help answer threads with 0 replies.
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 09-10-2010, 05:15 AM   #1
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
getting clone of hdd


A linux cvs server is of 250 GB , I have to replace all data to a new 500 GB hdd with intact of data. How will I do that ?
 
Old 09-10-2010, 05:21 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

There are various ways on doing that, if you have the necessary experience you can do it with the 'dd' command. If you prefer a GUI then have a look at something like CloneZilla.

Kind regards,

Eric
 
Old 09-10-2010, 05:30 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
dd is good but it could create havoc if used incorrectly. CloneZilla should be fine with it. The menu driven process should ease the usage as well as reduce the human errors with all the confirmation messages.
 
Old 09-10-2010, 10:58 AM   #4
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Original Poster
Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by EricTRA View Post
Hello,

There are various ways on doing that, if you have the necessary experience you can do it with the 'dd' command. If you prefer a GUI then have a look at something like CloneZilla.

Kind regards,

Eric
Ok sir , I'll definately try out clonezilla, it's gr8 to know as the alternative of norton ghost.
 
Old 09-10-2010, 11:28 AM   #5
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Nothing wrong with dd.

The command
Code:
dd if=/dev/sda of=/dev/sdb bs=32256
is all one needs to clone sda (250) into sdb (500Gb). You don't get anything simpler than that.

The red bit is optionally to accelerate the process as dd default to bs=512 if not specified. 32256 is one complete track of 63 sectors x 512 bytes per sector.

After cloning every binary bit is exactly the same in both disks. The 500Gb disk will have a partition table occupying the first 250Gb space and so the partitions can be resized using Gparted.

I prefer dd as it is a fundamental command of BASH and so you can do it with every Linux.

In cloning if one of the disks is hooked to a USB then the cloning speed can drop to 20 to 12Mb/s. Internal hard disks can be cloned at 80 to 45Mb/s depending on the hard disk model and CPU.

I believe Clonezilla has the advantage of speeding up the process a bit if there is a large empty space in the hard disk as dd copy only knows "1" and "0" and has no concept of data or space. Having said that Clonezilla is based on dd and so are many cloning software.

Last edited by saikee; 09-10-2010 at 11:34 AM.
 
Old 09-10-2010, 11:38 AM   #6
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Original Poster
Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by saikee View Post
Nothing wrong with dd.

The command
Code:
dd if=/dev/sda of=/dev/sdb bs=32256
is all one needs to clone sda (250) into sdb (500Gb). You don't get anything simpler than that.

The red bit is optionally to accelerate the process as dd default to bs=512 if not specified. 32256 is one complete track of 63 sectors x 512 bytes per sector.

After cloning every binary bit is exactly the same in both disks. The 500Gb disk will have a partition table occupying the first 250Gb space and so the partitions can be resized using Gparted.

I prefer dd as it is a fundamental command of BASH and so you can do it with every Linux.

In cloning if one of the disks is hooked to a USB then the cloning speed can drop to 20 to 12Mb/s. Internal hard disks can be cloned at 80 to 45Mb/s depending on the hard disk model and CPU.

I believe Clonezilla has the advantage of speeding up the process a bit if there is a large empty space in the hard disk as dd copy only knows "1" and "0" and has no concept of data or space. Having said that Clonezilla is based on dd and so are many cloning software.
yes dd is good ,but for dd will I have to boot from 250 GB with system connected to 500 GB . And then I have to increase the size of the cvs repository partition , for this will I have to make the 500 GB LVM ,then cloning or what is the procedure ?
 
Old 09-10-2010, 11:50 AM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
The beauty of dd is its simplicity.

The process is read a record, which is the block size defined by the parameter bs, from the input device and write on the output device. The process is repeated until the number of records exhausted in either the source or the target disk.

In your case the cloning will stop after the first 250Gb has been cloned and no more record can be read from the sda. The target 500Gb disk will show first 250Gb identical to the source disk and the second 250Gb being unallocated space.

Since I suggest bs=32256 bytes so the first record will be cloning the first track of 63 sectors. The first sector is the MBR and has the partition table so you do not need to do anything with the 500Gb disk which can be a raw disk directly from a purchase as you are intentionally forcing the 500Gb hard disk to have the same partition table of the source 250Gb disk.

In dd you create in the target disk a 100% mirror image of the source disk. It will be a LVM if you have it in the source. After cloning you can do whatever you like with the target disk. Enlarging the size of a partition should be a fast process with Gparted and even faster if it is a LVM.

Last edited by saikee; 09-10-2010 at 11:55 AM.
 
Old 09-10-2010, 11:58 AM   #8
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,087

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
check out redo backup&recovery which uses partclone
http://redobackup.org/

maybe its what you want or not
whichever you use please post the results?

its based off Xpud
http://www.xpud.org/

Last edited by linus72; 09-10-2010 at 11:59 AM.
 
Old 09-11-2010, 02:56 AM   #9
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Original Poster
Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by saikee View Post
The beauty of dd is its simplicity.
Thank you for explaining me a lot.But I have not performed these type of actions by dd before . So I have some doubts to ask :

1) 250 GB hdd is sda, it has a no of partitions(sda1,sda2...), So by dd after copying them to sdb(500 GB), will that sdb be converted into same (sdb1,sdb2,..) ?

2) Is it possible to resize(increase/decrease) the size of a partition(let sda4) can be increased without makiing the sdb LVM ?
 
Old 09-11-2010, 07:24 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by divyashree View Post
Thank you for explaining me a lot.But I have not performed these type of actions by dd before . So I have some doubts to ask :

1) 250 GB hdd is sda, it has a no of partitions(sda1,sda2...), So by dd after copying them to sdb(500 GB), will that sdb be converted into same (sdb1,sdb2,..) ?

2) Is it possible to resize(increase/decrease) the size of a partition(let sda4) can be increased without makiing the sdb LVM ?
1) Yes, dd will create the partitions as well as populating them with data.

2) Yes, partition sizes can be changed as long as there is adjacent space to grow the partition into. After growing he partition you will want to grow the file system. ext2/ext3/ext4 file systems can be resized using the resize2fs command; if it is not given a new size it defaults to using the entire partition.

In this LQ post, japa-fi sugests using conv=sync,noerror on the dd command line in case dd encounters read errors. I'm not convinced; it would be better to fail rather than write an inexact copy but I may be misunderstanding something.

If the source disk is active during the copy, dd will not create an exact "point-in-time" copy. Corruption is possible, for example you might create directory entries pointing at non-existent data blocks. For this reason you should not have any of the file systems on the source disk mounted during the copy. If it is not possible to run the system like that, it requires booting another OS to do the copy, for example Knoppix from DVD.
 
Old 09-11-2010, 11:00 AM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I will answer the two points differently as follow

(1) dd duplicates the binary pattern of one hard disk to another. So if the source has partitions so the cloned target will be too as the two are exactly the same. dd therefore will not "create" partitions by itself. It copies just the binary bits of "1" and "0" of the hard disk. Technically dd can therefore clone any operating system or any number of them if the whole disk is copied. dd differs from other copying commands because it has no concept of the filing system. The target disk always boots exactly like the source because the boot sectors, MBR and partition table, which aren't parts of the filing systems, are faithfully mirrored.

(2) To resize a partition is a system utility provided by special software like Gparted which deals with a lot more filing systems than resize2fs. dd can successfully copy the disk with which a Linux is running to host dd. dd copies the information from the hardware "device" while the operating Linux occupies mainly in the ram. A user should not actively changing the data of the source disk while it is being cloned. That should be common sense. Thus not mounting the partitions of the source disk is a safe approach but not mandatory. I have cloned the source hard disk while running a Linux on it many times but I do agree a safer approach is to use a Live CD.

Last edited by saikee; 09-11-2010 at 11:03 AM.
 
Old 09-12-2010, 02:56 PM   #12
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Original Poster
Rep: Reputation: 135Reputation: 135
Yes Catkin's second answer is what I was asking for. The partition sizes can be changed as long as there is adjacent space to grow the partition into.
 
  


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
RHEL: Clone HDD zabidin2 Linux - Server 1 03-04-2010 04:29 AM
clone identical HDD and leave both bootable owenm Linux - Enterprise 1 12-02-2008 05:11 PM
Redhat hdd clone suro Linux - Software 1 06-13-2007 04:29 AM
Clone HDD to increase Storage DjRakso Linux - Hardware 3 03-12-2007 01:25 PM
Gentoo test on virtual pc - can I clone HDD? solomage Linux - Distributions 1 01-15-2006 08:10 AM


All times are GMT -5. The time now is 10:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration