nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Question regarding dd backups

This is a discussion on Question regarding dd backups within the Linux software forums, part of the Linux Getting Started category; I have a simple question. If I used dd to make a full drive backup of a bootable drive will ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Linux answers from nixCraft.


Linux software General questions and discussion about Redhat/Fedora Core/Cent OS, Debian and Ubuntu Linux related to softwares should go here.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-13-2008, 10:08 PM
Junior Member
User
 
Join Date: Aug 2008
OS: Debian
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
websissy is on a distinguished road
Question Question regarding dd backups

I have a simple question. If I used dd to make a full drive backup of a bootable drive will the copied drive ALSO be bootable?

In other words, if I did a track-by-track clone of the drive won't it also automatically copy track zero thus making the backup copy a bootable exact twin of the original drive?

Both drives are dedicated linux drives. There are no Windows or Dos partitions involved.

The reason I ask this is because the file system on my server's primary hd is damaged. Fortuantely I have a backup that was made within hours of the time this damage occurred. So, I need to be able to swap the two hd's in my server and try to boot the second (backup) drive RATHER than the current (damaged) primary drive. I'm wondering whether I'll need to use dd to lay down a copy of the boot track on the secondary before I try this maneuver.

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-13-2008, 10:22 PM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 700
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Quote:
In other words, if I did a track-by-track clone of the drive won't it also automatically copy track zero thus making the backup copy a bootable exact twin of the original drive?
Yes, if you did run something as follows to make a track by track backup :
Code:
dd if=/dev/hda of=/dev/hdb conv=noerror,sync
You have exact duplicate bootable drive /dev/hdb (mirror of hda). However, this will only work if the disks are the same size and C/H/S geometry. It won't work if damaged hda was 40G and hdb is 80G.
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #3 (permalink)  
Old 10-14-2008, 12:22 AM
Junior Member
User
 
Join Date: Aug 2008
OS: Debian
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
websissy is on a distinguished road
Default

Okay... the boot of the backup worked. The next thing I did was a "do-no-harm" fsck of the backup and here's what it reports:

Code:
myserver:-# e2fsck -n -f /dev/sda1
e2fsck 1.40-WIP (14-Nov-2006)
Warning! /dev/sda1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check. 
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure 
Pass 3: Checking directory connectivity 
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (102099287, counted=102099288).
Fix? no
Free inodes count wrong (58602648, counted=58602652). 
Fix? no
/dev/sda1: ********** WARNING: Filesystem still has errors **********
/dev/sda1: 969576/59572224 files (0.2x non-contiguous), 17036737/119136024 blocks
If your primary hd was damaged... and a fsck check of your (identical hardware) backup drive showed this, what would you do next?

For the record, when I used fsck to do a manual recovery on the damaged file system of the primary hd (I basically approved all changes fsck recommended and cloned all "shared blocks") , even that messed up the original drive pretty badly.

But in all fairness, there was a week's worth of updates to that hd between the date the error was detected and reported by fsck and the date the journaling file system rolled us back to. Obviously that hasn't happened to this backup which has basically been offline since it was made.

Last edited by websissy; 10-14-2008 at 12:37 AM.
Reply With Quote
  #4 (permalink)  
Old 10-14-2008, 02:27 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,683
Thanks: 11
Thanked 241 Times in 181 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

This is not good:
Quote:
Warning! /dev/sda1 is mounted.
Never ever run fsck on mounted file system. It will destroy working file system for sure. Always run fsck on unmouted fs:
Code:
umount /dev/sda1
e2fsck -n -f /dev/sda1
See : Can I run fsck or e2fsck when Linux file system is mounted?
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #5 (permalink)  
Old 10-14-2008, 04:30 AM
Junior Member
User
 
Join Date: Aug 2008
OS: Debian
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
websissy is on a distinguished road
Default

Thanks! Yes. I do realize now e2fsck and fsck should not be run on a mounted file system. That's why I was deliberately running e2fsck in read-only mode at the time. I wanted it to check the drive but make no changes to it. Unfortunately, I hadn't yet fully understood the importance of that on Saturday when I found myself trapped in fsckland with no way to escape. So, I was probably the cause of some of the damage on my primary boot drive.

If you look close, you'll see the 4th line of the message acknowledged that e2fsck was not doing a journaled recovery because I had forced it to check the file system but placed it in read-only mode.

Code:
e2fsck -n -f /dev/sda1
e2fsck 1.40-WIP (14-Nov-2006)
Warning! /dev/sda1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
I have since asked the data center to reverse the drives again and they report the original primary hd is back as SATA1 and the backup is SATA2.

But I'm having trouble for some reason.

I do NOT have /dev/sdb1 included in the fstab table. Yet, when I reboot the system and try to run even the do-no-harm e2fsck test it warns me that sdb1 is mounted. And when I look linux show that partition when I list the root file system (ls -als /). In short, a directory named /sdb1 does exist in / (although when I list the contents of that directory it shows as empty).

Yet, when I try to umount /dev/sdb1 or /sdb1, the system reports it is not mounted. Also when I check the root directory where I normally mount this drive (mount /dev/sdb1 /backup) it also shows it as not present.

Yet, when I try to run:

e2fsck -nf /dev/sdb1

I STILL get

Warning! /dev/sdb1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.

Can you tell me what GIVES here and how I can get around it?

Thanks!
Reply With Quote
Reply

Tags
backup , dd command , disk recovery , linux , partitions


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
bonding question meirfin Networking, Firewalls and Security 0 09-24-2008 03:11 PM
C question TOP Coding in General 1 07-08-2006 12:14 AM
C question TOP Coding in General 3 03-10-2006 11:08 PM
question TOPHUMAN Shell scripting 1 02-06-2006 01:25 PM
Redirecting question sonaikar Linux software 1 06-25-2005 12:18 AM


All times are GMT +5.5. The time now is 07:03 AM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38