LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 11-14-2015, 05:25 AM   #31
chris319
Member
 
Registered: Jun 2003
Distribution: Linux Mint
Posts: 106

Original Poster
Rep: Reputation: 16

Here is a script I found somewhere on the web. It runs without error but also does not work.

The machine is booted from /dev/sda, so we are not trying to overwrite files on the boot disk. Rather, the boot disk is used as the source. It is supposed to write the files on /dev/sda/ to /dev/sdb/, which has a fresh Linux installation on it. I can boot from the destination disk when the copy is finished, but none of the apps, settings, etc. have been carried over from the source disk. I have no idea whether anything is actually being written to /dev/sdb/ or if the script is just spinning its wheels. /dev/sdb/ is a larger HD than /dev/sda/, so lack of disk space is not the issue.

Code:
mount /dev/sdb/ /destination
rsync -avxHAX --progress / /destination

Last edited by chris319; 11-14-2015 at 05:27 AM.
 
Old 11-14-2015, 08:21 AM   #32
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
some of your parameters are mutually exclusive (e.g.- -a means -H -A -X cant be used, -x means to stay on one filesystem).

i would do something like:
Code:
dd if=dev/sda of=/dev/sdb bs=16M

Last edited by schneidz; 11-14-2015 at 08:28 AM.
 
Old 11-14-2015, 09:01 AM   #33
chris319
Member
 
Registered: Jun 2003
Distribution: Linux Mint
Posts: 106

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by schneidz View Post

i would do something like:
Code:
dd if=dev/sda of=/dev/sdb bs=16M
Maybe this: copy one partition at a time to account for the different drive geometries?

Code:
# dd if=/dev/sda1 of=/dev/sdb1 bs=512 conv=noerror,sync

Last edited by chris319; 11-14-2015 at 07:30 PM.
 
Old 11-14-2015, 10:39 PM   #34
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by chris319 View Post
Maybe this: copy one partition at a time to account for the different drive geometries?

Code:
# dd if=/dev/sda1 of=/dev/sdb1 bs=512 conv=noerror,sync
Well, if the disk partitioning is different on the backup drive then you are not going to easily be able to create a directly bootable clone of the first drive. A clone is a clone, whereas file backups to a different filesystem is something else again.

I think that you are somewhat trapped between wanting to do things as you have in the past...

Quote:
Originally Posted by chris319 View Post
For years I've been cloning one disk to another. It takes about 20 minutes, just one program to run, no scripts to write, no thought required. The backups made this way have served me well in the event of HD crashes or in case I need to retrieve a file I messed up. The backups boot right up, no problem. It gets the job done. Nothing could be simpler.
...i.e. what I will call the window$ way (maybe not an entirely accurate analogy), a bootable bit image clone, and the more Unix-ish incremental file backups using rsync recommended by myself and many others here.

So perhaps you should pause and consider first whether your goal really is to have a bootable clone, or if efficient data backups is in the picture.

If you want a bootable clone then you should explicitly adopt the clone terminology. A clone can be used as a backup, but in the Unix/GNU/Linux sphere the term backup generally has a much different meaning. For a clone dd is definitely the way to go, but you need to forget about having different disk partitioning schemes - that would make it not-a-clone.

So for bootable clone, boot to a USB or DVD drive (i.e. not the drive you are cloning from or to), then...

Code:
dd if=/dev/sda of=/dev/sdb [options...]
Then if sda fails you just plug in sdb and boot...

If you want a clone AND a different partition scheme then forget about making it bootable. Instead, create a single partition on the backup drive big enough to hold the full source drive and use dd to clone to a file. Then if the source fails you can restore from the file to a replacement drive, then boot. You can also use compression to reduce the required storage on the backup as well. Something like this (/dev/sdb1 is formatted target partition)...

Code:
mount /dev/sdb1 destination
dd if=/dev/sda | gzip -1 - | dd of=destination/sda.img.gz

Then, if you have to restore...

connect new drive as /dev/sda and verify!
mount /dev/sdb1 source
dd if=source/sda.img.gz | gunzip -1 - | dd of=/dev/sda
This has the extra step of restoring from disk image first, but that image is stored as a file allowing the second disk to have other partition schemes.

Finally, and to restate my original post in this thread, if you want easy, incremental filesystem backups, as opposed to a disk clone, learn and use rsync.

That is really a fundamental difference between window$ thinking and Unix/GNU/Linux thinking, the difference between clone and backup. Which is not to say you should not clone the disk under Linux, no flames intended, but it is a difference in thinking that results from the fundamental difference in methods and approach.

Last edited by astrogeek; 11-14-2015 at 10:44 PM.
 
1 members found this post helpful.
Old 11-15-2015, 06:52 AM   #35
chris319
Member
 
Registered: Jun 2003
Distribution: Linux Mint
Posts: 106

Original Poster
Rep: Reputation: 16
Here is the backup strategy I have settled on:

Copy the source drive to a temporary backup file using a program called Redo: http://redobackup.org. Redo is a bootable CD. The backup file is about 24 GB and lives on my Windows NTFS HD. It is actually a suite of files that live in a single folder.

In the event of a disk crash, use Redo to reconstruct the original installation on a new, replacement HD.

Unlike a direct sector-to-sector copy, this process requires an additional drive to store the backup file (it could be a thumb drive if large enough). This process takes into account the different sizes of the two HD's I am using.

I have conducted a "fire drill" to see if the original HD can successfully be reconstructed. The fire drill was successful. I currently have two HD's with identical Linux configurations, giving me a bootable "hot" backup.
 
1 members found this post helpful.
Old 11-15-2015, 02:31 PM   #36
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
thanks for sharing. heres mine:
http://www.linuxquestions.org/questi...9/#post5408615
 
  


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
Backup software that can backup an ftp site mortalic Linux - Software 1 08-04-2010 03:25 PM
Backup software that can backup symbolic links Geert86 Linux - Software 2 01-20-2010 06:10 PM
Windows Backup Software (diff backup without archive bit) nkhajanchi.mg@gmail.com Linux - Software 4 09-09-2009 09:29 AM
New backup software fills huge open source software gap! gacott Linux - News 0 12-26-2007 02:57 PM

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

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