LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 11-11-2013, 03:45 AM   #1
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Rep: Reputation: 30
disk cloning ?


Dear All
I needed to clone my disk to another hard drive . I did it as the following :
#dd if=/dev/sdb of=/dev/sdc
But after a while, the procedure ended with the "writing to /dev/sdc
input/output error" message.
Can you please let me know how can I overcome this as the fdisk now returns as "
#fdisk /dev/sdc
"I do not know how to handle files with mode 81a4
must set cylinders"
What can I do at know ?
Thank you
 
Old 11-11-2013, 04:12 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It assumes that the two disks are the same size. sdc has to be at least as large as sdb or the copy will fail. And both disks need to be in LBA mode, as then there is no cylinder operations done.
 
Old 11-11-2013, 04:20 AM   #3
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Original Poster
Rep: Reputation: 30
Thank you for your help. Please be informed that both disks are 40GB. So what can I do next?
 
Old 11-11-2013, 04:43 AM   #4
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Original Poster
Rep: Reputation: 30
Please be informed that the second disk had the same geometry but got problem. So I tried to clone the first disk on it. Please comment.
 
Old 11-11-2013, 06:28 AM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,

Good LQ resource for the 'dd' command: Learn the DD command

You could try: Clonezilla Live 2.2.0-16 LiveCD to clone the drive.

Hope this helps.
 
1 members found this post helpful.
Old 11-11-2013, 06:49 AM   #6
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Original Poster
Rep: Reputation: 30
Thank you for your reply. If I want to format the target hard disk can you please let me know how to do that ?
 
Old 11-11-2013, 11:25 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,

Quote:
Originally Posted by hadimotamedi View Post
Thank you for your reply. If I want to format the target hard disk can you please let me know how to do that ?
'man mke2fs';
Quote:
NAME
mke2fs - create an ext2/ext3/ext4 filesystem

SYNOPSIS
mke2fs [ -c | -l filename ] [ -b block-size ] [ -D ] [ -f fragment-size ] [ -g blocks-per-group ] [ -G number-of-groups ] [ -i bytes-per-inode ] [ -I
inode-size ] [ -j ] [ -J journal-options ] [ -N number-of-inodes ] [ -n ] [ -m reserved-blocks-percentage ] [ -o creator-os ] [ -O feature[,...] ] [
-q ] [ -r fs-revision-level ] [ -E extended-options ] [ -v ] [ -F ] [ -L volume-label ] [ -M last-mounted-directory ] [ -S ] [ -t fs-type ] [ -T
usage-type ] [ -U UUID ] [ -V ] device [ blocks-count ]

mke2fs -O journal_dev [ -b block-size ] [ -L volume-label ] [ -n ] [ -q ] [ -v ] external-journal [ blocks-count ]

DESCRIPTION
mke2fs is used to create an ext2, ext3, or ext4 filesystem, usually in a disk partition. device is the special file corresponding to the device (e.g
/dev/hdXX). blocks-count is the number of blocks on the device. If omitted, mke2fs automagically figures the file system size. If called as
mkfs.ext3 a journal is created as if the -j option was specified.

The defaults of the parameters for the newly created filesystem, if not overridden by the options listed below, are controlled by the
/etc/mke2fs.conf configuration file. See the mke2fs.conf(5) manual page for more details.
See the 'man mke2fs' pages for option descriptions.
 
Old 11-11-2013, 12:25 PM   #8
qrange
Senior Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable/testing, amd64
Posts: 1,061

Rep: Reputation: 47
perhaps /dev/sdc has bad blocks, you should check S.M.A.R.T.

there is no need to format when using dd.
 
Old 11-11-2013, 03:33 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,997

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Checking the disk with some diags isn't a bad idea to start.


dd is a bit by bit. So, we might assume any number of issues. One common one is as suggested. The size is different. As to if drive is OK again suggested to test disk. Consider OEM diag cd too. They have best diag apps. Use memtest also. Use best quality cables and set bios to default or failsafe speeds. Could be selecting wrong ata setting. Some clone tools test it and adjust.

Fdisk might be used also to decide true size.

Some older systems may not like the drive if it has a large number of cylinders. Might have the chs limit jumper on it too.

Could always try clonezilla or redobackup.

Last edited by jefro; 11-11-2013 at 03:34 PM.
 
Old 11-11-2013, 11:42 PM   #10
hadimotamedi
Member
 
Registered: Aug 2009
Posts: 228

Original Poster
Rep: Reputation: 30
>>perhaps /dev/sdc has bad blocks, you should check S.M.A.R.T.

Can you please explain how to check it with smart ?
 
Old 11-12-2013, 01:41 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
http://www.techrepublic.com/blog/lin...r-hard-drives/ and refer http://smartmontools.sourceforge.net...martctl.8.html
 
Old 11-12-2013, 10:43 AM   #12
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
https://wiki.archlinux.org/index.php...tire_hard_disk says "This will clone the entire drive, including MBR (and therefore bootloader), all partitions, UUIDs, and data."
Code:
dd if=/dev/sdb of=/dev/sdc bs=4096 conv=notrunc,noerror

I did this 2 days ago, and while I don't have the disk yet, I called it successful when there were no "errors" reported,
and fdisk and cfdisk both reported the same same for both of them.
 
Old 11-12-2013, 10:59 AM   #13
qrange
Senior Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian stable/testing, amd64
Posts: 1,061

Rep: Reputation: 47
there's also a special version, 'ddrescue' for badblocks.
 
Old 02-17-2014, 08:25 PM   #14
irgunII
Member
 
Registered: Jan 2012
Location: Directly above the center of the earth
Distribution: Slackware. There's something else?
Posts: 383

Rep: Reputation: 72
Quote:
Originally Posted by Habitual View Post
https://wiki.archlinux.org/index.php...tire_hard_disk says "This will clone the entire drive, including MBR (and therefore bootloader), all partitions, UUIDs, and data."
Code:
dd if=/dev/sdb of=/dev/sdc bs=4096 conv=notrunc,noerror

I did this 2 days ago, and while I don't have the disk yet, I called it successful when there were no "errors" reported,
and fdisk and cfdisk both reported the same same for both of them.
Is the if the 'source' and the of the drive you want to be cloned?

I have my system running on my sdb drive (don't ask) and would prefer to have it on my sda as it's newer, faster and quieter. Would I use
Code:
dd if=/dev/sdb of=/dev/sda bs=4096 conv=notrunc,noerror
?

Do I need to do this while still in runlevel 3 or can it be done while in kde and browsing the web (for example)?

Last edited by irgunII; 02-17-2014 at 08:30 PM.
 
Old 02-18-2014, 06:48 AM   #15
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It is best to do it when /dev/sdb has no mounted partitions. Copying with it mounted allows for the possibility of an incomplete file being copied, which can cause some filesystem corruption - especially if files are being deleted.

Other than that restriction, you can do it anytime.
 
  


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
Disk cloning Diggy Linux - Software 12 01-28-2009 03:44 PM
Disk cloning question valnar Linux - Software 4 06-07-2005 02:41 PM
cloning disk using cp - no special devices for target disk vulture99 Linux - General 6 05-08-2005 05:36 PM
Cloning boot disk using DD vanibhat Linux - Hardware 3 12-01-2004 03:35 PM
Disk Cloning sts_cat Linux - General 1 03-24-2003 11:30 PM

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

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