LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-27-2011, 09:38 AM   #1
ununun
Member
 
Registered: Jun 2011
Posts: 82

Rep: Reputation: Disabled
Can i dd if=/dev/sdb of=/dev/sdc if hdsize(sdb)>hdsize(sdc) & size(sdb)<hdsize(sdc) ?


Code:
$parted -l
Model: Generic Flash Disk (scsi)
Disk /dev/sdb: 4216MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  4215MB  4214MB  primary  ext4         boot


Model: USBModem Disk (scsi)
Disk /dev/sdc: 3964MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      4194kB  3964MB  3959MB  primary
sdb1 is my current linux system.

i want to make exact bootable copy of sdb to sdc.

would
dd if=/dev/sdb of=/dev/sdc
do that ?

the actual size of sdb (which is hdsize(sdb) - free space(sdb)) is less than hdsize(sdc).
 
Old 06-27-2011, 09:58 AM   #2
dimm0k
Member
 
Registered: May 2008
Location: Brooklyn ZOO
Distribution: Slackware64 14.2
Posts: 581

Rep: Reputation: 56
Your best bet would be to resize sdb1 to match the size of sdc1 and then use dd. This is because dd will copy the disk sector by sector and there's a possibility there could be data at the end of sdb1 that would be truncated when it reaches the end of sdc.
 
Old 06-27-2011, 10:17 AM   #3
ununun
Member
 
Registered: Jun 2011
Posts: 82

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dimm0k View Post
Your best bet would be to resize sdb1 to match the size of sdc1 and then use dd. This is because dd will copy the disk sector by sector and there's a possibility there could be data at the end of sdb1 that would be truncated when it reaches the end of sdc.
i think to resize sdb1 (root partition) i have to boot from other linux. and thats what i was hoping to avoid.
 
Old 06-27-2011, 02:46 PM   #4
Karl Godt
Member
 
Registered: Mar 2010
Location: Kiel , Germany
Distribution: once:SuSE6.2,Debian3.1, aurox9.2+3,Mandrake?,DSL? then:W7st,WVHB, #!8.10.02,PUPPY4.3.1 now:Macpup
Posts: 314

Rep: Reputation: 45
Why don't you simple use the rsync command and copy it simply . This works for me to restore an accidentially wiped partition .
 
Old 06-27-2011, 11:18 PM   #5
dimm0k
Member
 
Registered: May 2008
Location: Brooklyn ZOO
Distribution: Slackware64 14.2
Posts: 581

Rep: Reputation: 56
Quote:
Originally Posted by ununun View Post
i think to resize sdb1 (root partition) i have to boot from other linux. and thats what i was hoping to avoid.
You are correct... if you want to resize the root partition, you cannot have it mounted so your two options would be to either get a "live" distro that contains gparted, boot off of the CD and resize from there. At the same time, you can dd while there as well. I use SystemRescueCD and PartedMagic from time to time for such operations. Your second option would be what Karl Godt mentioned and that is to use rsync to copy the files over from one drive to the other. This second option of course means you can do it without getting another distro and without needing to reboot.
 
Old 06-27-2011, 11:36 PM   #6
ununun
Member
 
Registered: Jun 2011
Posts: 82

Original Poster
Rep: Reputation: Disabled
i dont think rsync can clone MBR.

i am going with resize and dd.

i will let you know the result soon.

thanks for all help.
 
Old 06-28-2011, 11:48 AM   #7
Karl Godt
Member
 
Registered: Mar 2010
Location: Kiel , Germany
Distribution: once:SuSE6.2,Debian3.1, aurox9.2+3,Mandrake?,DSL? then:W7st,WVHB, #!8.10.02,PUPPY4.3.1 now:Macpup
Posts: 314

Rep: Reputation: 45
You possible may copy the mbr with
Code:
dd if=/dev/sda of=/dev/sdb bs=512 count=1
And to check :
Code:
 dd if=/dev/sdb of=/MBRsdb bs=512 count=1
and
Code:
file /MBRsdb
should look like
/MBRsdb: x86 boot sector;
partition 2: ID=0xf, starthead 254, startsector 71312535, 905455530 sectors;
partition 3: ID=0x83, starthead 254, startsector 20755980, 20627460 sectors;
partition 4: ID=0x83, starthead 254, startsector 41383440, 29929095 sectors, code offset 0x5e

The output above is done using grub4dos-V0.4.4 . Why partition 1 is missing I don't know .
Grub4dos is installed to partition 1 . Works ok for me .
 
  


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
Problems with an USB hard disk (ext3) - sdb reappeared as sdc cabrilo Linux - Hardware 6 02-18-2011 04:44 AM
[SOLVED] Adding harddrive sdb becoms sdc jocef Linux - Hardware 2 01-13-2011 01:53 PM
[SOLVED] Hardware RAID card, array migrated, refresh /dev/sdc to show new size batfastad Linux - Hardware 1 12-23-2009 06:33 AM
Installing grub on /dev/sdb or /dev/sdc Skaperen Ubuntu 4 07-18-2009 07:45 PM
sda sdb sdc drives not consistent ufmale Linux - Newbie 6 05-27-2008 06:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:00 AM.

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