LinuxQuestions.org
Help answer threads with 0 replies.
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 05-16-2015, 10:04 PM   #1
willc86
Member
 
Registered: Dec 2014
Posts: 54

Rep: Reputation: Disabled
dd command for backing up linux OS..am i doing this right?


hey guys, I understand how dd works. Ive been researching on it and I see that
if="" is the source of what I want to copy
of="" is that target that I want to send the back up to

so, what i am trying to do it copy my hard drive from saturn server: /dev/sda1 over SSH to my backup server skyline.

so [saturn harddrive /dev/sda1] -----backup---> [skyline:/backup/directory]


this is the command I am using
sudo ssh willc86@skyline "dd if=/dev/sda1 " | dd of=/backup/saturn.img

however, it is saying failed to open /dev/sda1/ : permission denied and I am runnign as root. any idea why?

thanks a bunch guys!
 
Old 05-16-2015, 10:50 PM   #2
New2Linux2
Member
 
Registered: Jan 2004
Location: Arizona
Distribution: Debian
Posts: 153

Rep: Reputation: 43
Ok. So you have the basics. Your point of confusion is in the interaction with ssh. Secure shell connects that terminal session to another terminal, in your case, a terminal on your saturn server. Within SSH you are no longer sending commands to your local computer, so /dev/sda1 will actually point to the saturn server's drive.

I recommend that you familiarize yourself with scp, secure copy. SCP uses a secure shell connection to another terminal for the explicit purpose of copying data from one system to another.

I also recommend you read a bit more on dd. A better dd command will look more like
<code>dd if=/dev/sda1 of=/some/other/device</code>
Good luck and let us know if this helped.

By the way, kudos for actually posting the command that you need help with. You're already a step ahead of the game.
 
Old 05-16-2015, 10:51 PM   #3
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,439

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
Nope.
You are running it as willc86 on skyline and it is attempting to read /dev/sda1 on skyline.

Probably you want to mount the destination locally and then run your dd command.
 
Old 05-17-2015, 07:00 AM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
This command of yours only puts a image of sda1 in your remote server storage space only. So first make a sda1 image. And then use scp or better rsync to transfer file.
 
Old 05-17-2015, 11:17 AM   #5
New2Linux2
Member
 
Registered: Jan 2004
Location: Arizona
Distribution: Debian
Posts: 153

Rep: Reputation: 43
Quote:
Originally Posted by descendant_command View Post
Nope.
You are running it as willc86 on skyline and it is attempting to read /dev/sda1 on skyline.

Probably you want to mount the destination locally and then run your dd command.
Oh. Woops! Thanks descendant_command. I guess my brain just skipped right over the username and servername. My bad.

I agree with the suggestion of mounting the remote destination locally. That will make the dd command much simpler.
 
Old 05-17-2015, 12:11 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,518

Rep: Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696Reputation: 1696
It isn't obvious which server you are running the command from. What you posted would work if you were running from skyline and if you ssh into Saturn as root.

As stated there are several ways to accomplish the same thing which may be easier.
 
Old 05-17-2015, 12:44 PM   #7
willc86
Member
 
Registered: Dec 2014
Posts: 54

Original Poster
Rep: Reputation: Disabled
i am doing this command from skyline

anyhow, i think I am going to transfer it over from the same drive over
prior to doing dd command, is there anything else I need to do? exclude /proc or dd takes care of everything on the spot? and its really that easy
 
Old 05-17-2015, 01:01 PM   #8
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,497

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
In the thread title you state "backing up a Linux OS". DD is not the correct tool for backup. Its a tools for drive imaging or drive cloning whatever you call it. It makes a bit-by-bit copy of your disk.

Are you sure that is what you want? Usually a backup is on file level. Not on bit level. Especially because you want to do your backup over SSH, it is unlikely you want that image. Other utilities for copying on the file level like rsync come to mind.

jlinkels
 
Old 05-17-2015, 01:05 PM   #9
willc86
Member
 
Registered: Dec 2014
Posts: 54

Original Poster
Rep: Reputation: Disabled
urgh ok I am getting a bit confused lol sorry.

what is the correct way to back up your system, then restore it back if a configuration goes wrong. DD command is not a good way? I would like to back up the entire drive; or should I just use clonezilla


actually - i see why. I noticed dd copys the entire drive, even the blank spaces =/

Last edited by willc86; 05-17-2015 at 01:46 PM.
 
Old 05-17-2015, 04:47 PM   #10
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,497

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
There are many backup options in Linux. Rsync serves me well. It backs up every file. But it does not create a bootable image. That means after a full crash you have to install a minimum system and then rsync all files back to restore the original system state.

jlinkels
 
Old 05-17-2015, 08:25 PM   #11
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian
Posts: 1,054

Rep: Reputation: 276Reputation: 276Reputation: 276
Which backup package to use depends on your needs. Rsync, tar, dd, and many others will do the job, but it depends on what the job really is. If you want to be able to just take the backup and use it to make a bootable drive on a new HDD, then dd may be what you want. If you just want to restore the backup to a working bootable drive, it probably isn't. Only you know exactly what you want or need. Different people have different needs, and that's why there are many options available.
 
Old 05-17-2015, 09:16 PM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,283

Rep: Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986
<soapbox>
dd is never the correct option for backup. Unless you're doing forensics.
</soapbox>

There are uncounted options for backup - some have been mentioned in this thread. As usual the Arch doco is exemplary - have a look over this synopsis.
 
  


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
[SOLVED] best tar command for backing up files krwinfield Linux - Newbie 1 06-26-2014 12:32 PM
Backing up user files from the command line? skaldicpoet9 Ubuntu 4 07-17-2013 08:53 PM
LXer: Backing up a Personal DVD in Linux with Command-line Tools LXer Syndicated Linux News 0 01-04-2011 12:50 AM
LXer: Backing Up and Restoring Using the cpio Command in Linux and Unix LXer Syndicated Linux News 0 05-26-2006 01:33 PM
backing up linux to cd-r/rw mdjames0 Linux - Newbie 2 07-26-2002 01:34 PM


All times are GMT -5. The time now is 04:22 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration