Solved

dd to NFS or CIFS

Posted on 2009-04-06
9
825 Views
Last Modified: 2013-12-06
Short story:

Have a Windows 2003 server with 3 RAID drives.  One is dying.  Have a spare, but it's done in hardware RAID and I think that is screwing up too.  I want to dd the drives so I have good images in case the drives completely go South.

The problem:  The only servers with enough storage to handle the drives are a Windows 2003 box with a SMB/CIFS share, and FreeBSD box with an NFS share.

How do I dd to a share?  I have tried creating a mount point and assigning it to the SMB share, but that didn't work.  

Note: The server's disks I am trying to rescue will not boot!  I am using a Linux boot CD to get to where I am.
 
0
Comment
Question by:dougp23
  • 4
  • 3
  • 2
9 Comments
 
LVL 7

Accepted Solution

by:
martin_2110 earned 400 total points
ID: 24081129
If you have another server with sshd running on it say the nfs server you could skip the mounting and do a dd over ssh

dd if=/dev/hda | ssh username@nfsserver  "dd of=/directory_of_backups_on_ssh_server/backupfile.iso"
0
 
LVL 7

Expert Comment

by:martin_2110
ID: 24081724
Make sure you check to see if your image is valid also.....
mkdir /mnt/a
mount -o loop ~/backupfile.iso /mnt/a
ls /mnt/a
0
 
LVL 1

Author Comment

by:dougp23
ID: 24087830
OK, looks like the dd is working, I can't tell.  After awhile the server that is running off the linux boot CD just gets non-responsive.  Looks like about 10GB copies over, the disks are (I think) 17GB.  So this might be right as I imagine not all of the disk space was used.

Martin, I can't grasp the logic of your script (it's my limited expertise, trust me).  I assume these commands should be run on the NFS box that is RECEIVING the image.  One problem:  the box is FreeBSD which doesn't support the o option in mount.  I'm checking right now for how or if this can be done in BSD.

Thanks.  
0
 
LVL 7

Expert Comment

by:martin_2110
ID: 24091310
<dougp23>OK, looks like the dd is working, I can't tell.  After awhile the server that is running off the linux boot CD just gets non-responsive.  Looks like about 10GB copies over, the disks are (I think) 17GB.  So this might be right as I imagine not all of the disk space was used.

<Martin> It should not become unresponsive. You may be correct about the disk problem. You may want to try changing the command by adding "conv=noerror,sync" to the command. for example:
dd if=/dev/hda conv=noerror,sync | ssh username@nfsserver  "dd of=/directory_of_backups_on_ssh_server/backupfile.iso"
This will carry on past any read errors, substituting zeros for the unreadable sectors.

<dougp23>  One problem:  the box is FreeBSD which doesn't support the o option in mount.
<Martin> I am not a bsd guy but this may help "http://www.freebsddiary.org/iso-mount.php"

<Dougp23> I can't grasp the logic of your script
<martin> The first part "dd if=/dev/hda" does a dd to standard out. I then pipe it over ssh to a dd  command running on the other server
 "| ssh username@nfsserver  dd of=/directory_of_backups_on_ssh_server"
which takes the standard out from the other dd command as standard in.

<Dougp23> I assume these commands should be run on the NFS box that is RECEIVING the image.
<martin> The mount command should be run on the BSD nfsserver.
The ssh command should be run on the bad disk server.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 7

Expert Comment

by:martin_2110
ID: 24091359
You might also consider checking out ghost for linux also.
http://redkrieg.com/2007/03/19/ghost-4-linux-complete-guide-to-imaging/

I would also recommend you also do a file level backup to be on the safe side if you loose anything.

Becarful!! :)
0
 
LVL 18

Assisted Solution

by:larstr
larstr earned 100 total points
ID: 24092585
Why don't you convert this server to a virtual machine? (now that there are several freely available virtualization solutions)

The safest method would be to create a MOA cd so you could get a cold clone of the system. MOA is using VMware Converter and will give you 1 virtual disk file per logical drive. VMware converter also understands NTFS and this speeds up things (compared to using dd) if you have large blocks of unused disk space on your system.

Even if the system disk wont boot (either physical or in a vm) you could easily add the data disks to another working virtual machine.

Lars
0
 
LVL 1

Author Comment

by:dougp23
ID: 24093096
martin> I intend to be very careful!  

larstr>I might give this a shot.  My problem is that this server has 3 drives, in a hardware RAID 5 setup.  I believe one of the disks is shot, rendering the server unbootable.  I made the mistake of going into the RAID BIOS and saying "Remove the Logical Drive". That was bad, not as bad as saying "Initialize".  So I need to backup the disks before I try to recreate the array.  I am not sure if using MOA I could somehow - in software - recreate the array, and then copy those folders to a new machine.

It's late, I'll see how it all goes tomorrow.
0
 
LVL 18

Expert Comment

by:larstr
ID: 24095020
You removed the RAID config from the RAID controller?!!

What RAID controller are you having in your system?

Lars
0
 
LVL 1

Author Comment

by:dougp23
ID: 24096318
Hey Lars.  It's MegaRAID BIOS.  I did something like "Clear Logical Drive Config".  According to the documentation, all the data is still intact until I initialize, which I don't plan to do for a LLLOOONNNNGGGG time!  Just finishing the last "dd" now.  Now I plan to go into the BIOS and recreate the array, mark drive 2 (using ordinal numbering) as bad, and see if I can rebuild it to my hotswap.

I'm open to all sorts of ideas of course!!

Doug
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now