LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-20-2012, 09:28 PM   #16
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,001

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629

I know these guys are helping you but I just wanted to add in some stuff.

Some older and odd versions of netcat may not work as expected.

Don't know what the commercial cost of using G4U is but I use it. It is a simple bootable floppy or cd that allows you to backup over the network to a ftp server. It does use dd and gzip's it so zero the free space would help.

Clonezilla is pretty easy too. Generally it is a file based copy so it should copy faster. Unless your drives are full, dd may take quite a while.

Redobackup may also suite your needs.

Here is my saved data I got from some place that I can't quote exactly.

Requirements:

Bootable Linux CD (I like http://lnx-bbc.org) that has dhcpcd, coreutils, and ftp.

A FTP Server (with a valid username and password). Lots of free disk space.
Warning: This is relatively safe if used correctly. I accept no responsibility for damage to your system!

Step 1. Boot your system using the bootable CD.

Step 2. Verify your system is on the network. # ifconfig

Step 3. Connect to your FTP server and upload the image. # ftp 10.131.8.102 Connected to 10.131.8.102 (10.131.8.102). Name : install Password: XXXXXXXXXX 230 Login successful. Using binary mode to transfer files.


ftp> put |"dd if=/dev/hda bs=1M|gzip -1" diskimage.gz


Or netcat.

nc -l 19000|bzip2 -d|dd bs=16M of=/dev/sdb
This tells netcat to listen on port 19000 for incoming data, then pipe that data to bzip for decompression, and then finally pipe the decompressed data to dd to be written to /dev/sdb.
Once we have this listening (you won't see any output after you hit Enter), we can move on to starting the data transfer on serverA:
dd bs=16M if=/dev/sda|bzip2 -c|nc serverB.example.net 19000

Last edited by jefro; 03-20-2012 at 09:32 PM.
 
Old 03-21-2012, 08:00 AM   #17
davemac2626
Member
 
Registered: Mar 2012
Posts: 33

Original Poster
Rep: Reputation: Disabled
hi Noway2

Thanks so much the image is now showing as 24Gb which seems to be much better and the md5sum is matching so great news - the only issue i am having now is the restoring process yet again!!!

on the server that will take the new image i have put:

nc -l 1234 | gzip -d | dd of=/dev/sda

it appears to listen and wait for anything incoming....

on the server that is pushing the image i have put:

dd if=/home/sda.image.gzip | nc 192.168.0.3 1234

however it does not appear to send anything! I can ping both machines from each other so the connectivity is there....

Is there anything small i am missing???

Thanks again for the help so far

Dave
 
Old 03-21-2012, 08:01 AM   #18
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
check you can connect to the netcat listening port manually, "telnet 192.168.0.3 1234" is probably the easiest way.
 
Old 03-21-2012, 08:10 AM   #19
davemac2626
Member
 
Registered: Mar 2012
Posts: 33

Original Poster
Rep: Reputation: Disabled
Hi Chris

No i cant connect :s :

Could not open connection to the host, on port 1234: Connect failed

now i'm stumped!!! - i have configured the receiving machines' eth0 for the right ip address and gateway (no firewall exists) and is booted with live cd....

Any ideas??

Many thanks
 
Old 03-21-2012, 08:35 AM   #20
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well no ideas without a full set of configs, but usual suspects are an incorrect IP, iptables (or similar) on the destination, service not listneing on the right interfaces (netstat -plnt on the listening side). Your IP's in your examples have certainly varied a fair bit, but seem too simple for you to not have nailed down on your side really.
 
Old 03-21-2012, 10:39 AM   #21
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
You may also need to run netcat as root (sudo) in order to get it to listen on the desired port. Once you have it running, confirm with netstat that it is indeed listening on the desired port, as was suggested. Then you can move to the remote machine, use nmap to confirm that the port is open through to that end. If it is, you should be able to connect using telnet as a test. When you do, you should be able to type on the remote machine and have it appear at the terminal at the server. I just tested this across the network with two machines and I found I needed to run netcat as root to get it to listen on something other than a high random port and my firewall (iptables) was in the way.
 
Old 03-21-2012, 10:47 AM   #22
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
as 1234 > 1024 there *shouldn't* be an issue with permissions, but who knows.
 
Old 03-21-2012, 11:00 AM   #23
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
I stand corrected. I had another problem. The version I was running required the -p flag to assign the port number.
 
Old 03-22-2012, 11:28 AM   #24
davemac2626
Member
 
Registered: Mar 2012
Posts: 33

Original Poster
Rep: Reputation: Disabled
Hi chaps

did some testing and can netcat a text file using the port 1234 from one machine to the other its just the image that doesn't seem to want to be copied back. I have logged in as root so cant be a permissions thing, selinux is disabled and as just stated can netcat a text file so cant see why the image does not want to go!

I have even tried piping through netcat first on source machine then pipe tto netcat after this but again no joy!

At least I can do the backups now I guess its just restoring the image if it ever went wrong that I still need to work on! I also tried manipulating my fog server to try and push the image out but still no joy - this was done by creating a new image on the fog server then overwriting that with the dd image (uncompressed) that i took in the early stages.....(same image name was used).

If there is anything else anyone can suggest I am open to experimenting and would be very grateful of the help?!

Many thanks

Dave
 
Old 03-23-2012, 06:44 AM   #25
davemac2626
Member
 
Registered: Mar 2012
Posts: 33

Original Poster
Rep: Reputation: Disabled
Hi Jefro

Thanks for the tips - the only issue with using clonezilla etc is that the production servers cannot really be rebooted to PXE mode hence the reasoning behind using DD to create the image. The imaging of the drive in the server is pretty much sorted its just purely using that image to create a replica of the original server that i am having issues with. At the moment the image has made and is sitting on the backup server however when i go to netcat it back to a new machine it doesnt want to send it, even though i am logged in as root and all firewalls are disabled. The host listens on the specific port nc -l 1234 and i can ftp to that port from my laptop so thats fine.....the server that is holding the image is not for some reason sending the image via netcat at all - is there any software that anyone knows of that can actually do all this for you - or even better does anyone have the process i am trying to achieve already setup and working?

Thanks for the posts so far everyone

Dave
 
Old 03-23-2012, 08:09 AM   #26
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Quote:
the server that is holding the image is not for some reason sending the image via netcat at all
You were able to confirm that the problem is on the transmitting end? Unfortunately, "not sending" isn't very helpful with regards to troubleshooting. Do you get an error message? Does the system just hang(*)? Is there any indication in one of the logs, e.g. syslog, messages, etc that could provide a clue as to why it is refusing to read the file? Does the user have permission to read the file, including any ACL rules such as SELinux?

(*)The imaging process can take a LONG time. During this time the process can appear to hang. To see if it is actually doing anything, you can stop the process with CTRL-C and see if you get anything like 0+1 records in, 0+1 records out as indication of activity with DD. There are a few how to documents that also describe how to use the process signals to cause the operation to pause and report percentage status completed. You will need to search the howto docs for this as I can't recall the syntax.
 
  


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
Why so complicated? Replace DVD/CD install images with USB images browny_amiga Linux - General 4 09-21-2009 02:08 PM
Span debian CD images into DVD images Christopher2222 General 3 09-01-2008 11:25 AM
netcat -e Devilz Linux - Networking 5 01-03-2008 02:05 AM
C++/SDL: Images moving too slowly. Images loaded once, etc. Why? RHLinuxGUY Programming 2 05-26-2007 05:11 PM
Restoring SLES 8 images automatically womacks Linux - General 0 01-06-2004 07:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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