Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How can I backup a Debian server to an ISO or IMG file?

New to Debian (Or Linux in general)? Ask your questions here!
Message
Author
Debra
Posts: 6
Joined: 2014-11-29 23:04

How can I backup a Debian server to an ISO or IMG file?

#1 Post by Debra »

We set up a home theater backend using TVHeadEnd installed on Debian 7. We did not install a desktop because TVHeadEnd doesn't need it, so use of a GUI-based backup program is out. What I would like to know is if there is a relatively easy way to create a full backup in the form of an ISO or IMG file that could be used to completely restore the system. We were going to use Mondo Rescue but it appears not to work with Debian and also the version they are offering now loads a lot more questionable dependencies than it used to - the one that really worried us was mdadm, because we don't have RAID, just a simple single 1 TB hard drive formatted ext4, and when we removed it (and all the other new software installed with Mondo) it printed this:
Removing mdadm ...
[ ok ] Stopping MD monitoring service: mdadm --monitor.
W: mdadm: I'll update the initramfs, but if you need MD to boot
W: mdadm: with initramfs, your system may be left unbootable!
So right now we're hoping the system will still reboot! Anyway, that's the gist of what we are trying to do, create an ISO or IMG file that could be used to do a full, bootable restore from a known good point if we manage to mess something up.

We have a Raspberry Pi that runs Raspbx, with Raspian as the underlying OS, and it has a script called raspbx-backup that is rather long but at the core it seems to be using dd to copy everything to an IMG file. So I looked at dd and I cannot determine exactly what options I'd need to use to get what I want under Debian, since I'm trying to back up a hard drive and not an SD card. So I'm curious whether anyone uses dd to back up their system to an ISO or IMG file, and if so, would you please be so kind as to tell me what options you use?

Or is there a better or easier way to do this, keeping in mind that it must be something we can do from the command line?

Just to throw out one other thing, ideally I'd LIKE to be able to exclude from the backup two directories that contain nothing but temporary video files (/hts/recordings and /hts/timeshift). But as far as I can tell dd has no way to do that, it seems to be a full disk clone utility. It's not THAT important if I can't do that, but it is something that would be desirable, providing it doesn't make this task more complex.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 12 times
Been thanked: 66 times

Re: How can I backup a Debian server to an ISO or IMG file?

#2 Post by dilberts_left_nut »

dd probably isn't what you want - it makes an exact copy of whatever you feed it and takes no account of filesystems or free space etc., so you can't exclude and files or dir's because that is not what it's copying, just a stream of bits. So to dd a 1TB partition you will end up with a 1TB image file.

Clonezilla may be a better tool, but I haven't really used it much so can't give you any specifics.

refractasnapshot may also be worth a look.

Also there are a bunch of backup utils in the repos that use various methods that may work for you.

rsync is usually my weapon of choice for backups and "point-in-time" snapshots of filesystems (works nice with the --link-dest option for hard-linked "deduplication").
AdrianTM wrote:There's no hacker in my grandma...

schnuller
Posts: 386
Joined: 2014-11-25 05:05

Re: How can I backup a Debian server to an ISO or IMG file?

#3 Post by schnuller »

I don't think backing up a harddisk or a SD-card makes any difference.

That would be the command to backup raspian:
dd if=/dev/sdb of=/path/to/backupfile.img
What further options are you looking for?

I got that right: The installation you want to backup ist *not* a raspberry pi?
(If i am wrong and it is: I wouldn't bet refracta or an iso would be of any use).

From the warning in quote-blocks i can't see why it shouldn't boot anymore.
It would make me nervous too (on a raspberry, else repairing it doesn't seem that hard).

scientific
Posts: 7
Joined: 2013-11-13 07:33

AW: How can I backup a Debian server to an ISO or IMG file?

#4 Post by scientific »

Is btrfs an option for you?
If not, try rsnapshot.

http://gesundheit.xundeenergie.at

Debra
Posts: 6
Joined: 2014-11-29 23:04

Re: How can I backup a Debian server to an ISO or IMG file?

#5 Post by Debra »

dilberts_left_nut wrote:dd probably isn't what you want - it makes an exact copy of whatever you feed it and takes no account of filesystems or free space etc., so you can't exclude and files or dir's because that is not what it's copying, just a stream of bits. So to dd a 1TB partition you will end up with a 1TB image file.
Okay, that doesn't sound good.
dilberts_left_nut wrote:Clonezilla may be a better tool, but I haven't really used it much so can't give you any specifics.
I've looked at Clonezilla and while it seems like quite a capable program, and reminds me of Redo Backup which I have used in the past to clone a hard drive, it has two drawbacks. One is that you have to shut down the system and then boot into Clonezilla. I would much prefer the system continue to be operational while the backup is made. I do realize this means there is a small chance that a file or two may not be complete but I don't think that would matter much. And the other is that it doesn't let you exclude directories. That said, it appears that Clonezilla may compress the backups, so a backup of a 1 TB drive would not take up a full 1 TB on the destination.
dilberts_left_nut wrote:refractasnapshot may also be worth a look.
That looks very interesting, but also somewhat complicated. As far as I can tell, it's sort of a wrapper for two programs, rsync and genisoimage. I'm just not sure if it's really suitable for what I am trying to do because there isn't that much information about it. And since it comes packaged as an ISO file, I assume it has the same problem as Clonezilla in that you can't backup a working system.
dilberts_left_nut wrote:Also there are a bunch of backup utils in the repos that use various methods that may work for you.
There may well be but at this point I don't really know what to look for.
dilberts_left_nut wrote:rsync is usually my weapon of choice for backups and "point-in-time" snapshots of filesystems (works nice with the --link-dest option for hard-linked "deduplication").
I don't at all understand what you mean by '(works nice with the --link-dest option for hard-linked "deduplication")' but other than that, it appears that rsync would do much of what we want. However what I do not know is how you back up an entire drive with rsync, including all partitions but excluding selected directories, into a format that can be used to do a complete restore. The downside of rsync appears to be that you have to be able to actually run it to restore anything, and if the system is non-operational that is not going to happen.

Thank you for the response, you have given me some things to consider.

Debra
Posts: 6
Joined: 2014-11-29 23:04

Re: How can I backup a Debian server to an ISO or IMG file?

#6 Post by Debra »

schnuller wrote:I don't think backing up a harddisk or a SD-card makes any difference.

That would be the command to backup raspian:
dd if=/dev/sdb of=/path/to/backupfile.img
What further options are you looking for?
Just that I was rather hoping not to have to back up a full 1 TB drive, since that could take hours, and also rather wanted to be able to exclude directories. On the flip side of the coin, since you can run dd from a working system, it may indeed turn out to be the only thing that will work. But if I have to use that, backups will probably be a lot less frequent than I would prefer.
schnuller wrote:I got that right: The installation you want to backup ist *not* a raspberry pi?
Correct.
schnuller wrote:(If i am wrong and it is: I wouldn't bet refracta or an iso would be of any use).

From the warning in quote-blocks i can't see why it shouldn't boot anymore.
It would make me nervous too (on a raspberry, else repairing it doesn't seem that hard).
As a relatively inexperienced user I would not have any idea how to repair a system that won't boot. The only thing I would know to do is reinstall everything, including the operating system, from scratch. :(

User avatar
alan stone
Posts: 269
Joined: 2011-10-22 14:08
Location: In my body.

Re: How can I backup a Debian server to an ISO or IMG file?

#7 Post by alan stone »



User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Re: How can I backup a Debian server to an ISO or IMG file?

#9 Post by Hallvor »

I have used this in the past: https://en.wikipedia.org/wiki/Partimage
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

andre@home
Posts: 398
Joined: 2011-10-02 08:00

Re: How can I backup a Debian server to an ISO or IMG file?

#10 Post by andre@home »

Hallvor wrote:I have used this in the past: https://en.wikipedia.org/wiki/Partimage
He needs ext4 support...
Partimage:
Partimage is limited to cloning partitions that have supported filesystem types. This includes Ext2, Ext3, Reiserfs, FAT12, FAT16, FAT16B, FAT32, HPFS, JFS, Xfs, UFS, HFS and Ntfs. Partimage does NOT support Ext4 and Btrfs [7]
When you clone a complete disk in raw mode and this mode is supported... you may do that....

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Re: How can I backup a Debian server to an ISO or IMG file?

#11 Post by Hallvor »

Sorry, I missed that part. I haven't used it for a few years, but it must have been before ext4... :oops:
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

schnuller
Posts: 386
Joined: 2014-11-25 05:05

Re: How can I backup a Debian server to an ISO or IMG file?

#12 Post by schnuller »

That looks very interesting, but also somewhat complicated. As far as I can tell, it's sort of a wrapper for two programs, rsync and genisoimage. I'm just not sure if it's really suitable for what I am trying to do because there isn't that much information about it. And since it comes packaged as an ISO file, I assume it has the same problem as Clonezilla in that you can't backup a working system.
It isn't complicate.
You install it and run it as root. The result is an iso.

To create an iso you *will* need genisoimage. So if you want to create an iso, then ...
in other words: it is mainly rsync.

You can use it from a running system.

You can easily exclude data you don't want to be backed-up, by simply editing the config file.

To make it short: it is pretty much usable by anyone.
Install it and run it once to check it out.

They (the ones who write those script) have got a forum, in case you got further question: refracta.freeforums.org

-
Regarding your other post.
If you got problems to repair a system, you can ask in a forum or IRC chat.
It is so easy that it can be explained in a couple of words.
As long you got a good backup (i agree with dilbert: rsync is my weapon of choice) the worst thing which might happen is the lack of a grub-loader (which is a no-brainer).
in other words: Don't worry that much (better too much than not at all, of course).
But if you got a backup, you can always restore (no need for an img or an iso, any form of full backup). No need to reinstall

Good luck.

schnuller
Posts: 386
Joined: 2014-11-25 05:05

Re: How can I backup a Debian server to an ISO or IMG file?

#13 Post by schnuller »

Perhaps someon else can comment on the warning.
To me it really sounds more like an info than a "next boot your system won't boot anymore, OMG-kinda warning".

I got no idea why MD should be needed to boot.

Debra
Posts: 6
Joined: 2014-11-29 23:04

Re: How can I backup a Debian server to an ISO or IMG file?

#14 Post by Debra »

First, thank you to everyone who has commented. I have been looking at the various options and just can't seem to find anything that clicks all the boxes. Still considering my options.
schnuller wrote:
That looks very interesting, but also somewhat complicated. As far as I can tell, it's sort of a wrapper for two programs, rsync and genisoimage. I'm just not sure if it's really suitable for what I am trying to do because there isn't that much information about it. And since it comes packaged as an ISO file, I assume it has the same problem as Clonezilla in that you can't backup a working system.
It isn't complicate.
You install it and run it as root. The result is an iso.
I cannot see any way to install it in Debian 7 (Wheezy) - I only see versions for older Debian releases.
And when I go to http://refracta.freeforums.org/refracta ... -t111.html it looks like people are having a lot of problems with it.

Unfortunately I just got called away so don't have time to go into more detail right now. But thank you again for the suggestions.

schnuller
Posts: 386
Joined: 2014-11-25 05:05

Re: How can I backup a Debian server to an ISO or IMG file?

#15 Post by schnuller »

If i tell you that it works then i mean it.
I wouldn't post it if there were doubts
Then i would post that it might fail.

Debra
Posts: 6
Joined: 2014-11-29 23:04

Re: How can I backup a Debian server to an ISO or IMG file?

#16 Post by Debra »

schnuller wrote:If i tell you that it works then i mean it.
I wouldn't post it if there were doubts
Then i would post that it might fail.
I just noticed your signature. That gives me the impression that you are one of those guys who knows a lot, but getting you to actually share what you know can be quite a challenge.

I have no doubt it works for you. But just because it works for you does not mean that everyone can get it to work. I'm sure you know where to download a version that works with your Debian version, and how to install it, but I don't. And you probably don't need good documentation written at a beginner's level, because you already know how to use it, but I do need that. And I'm sure you either haven't experienced, or know how to work around the issues people have encountered that posted in that forum thread I mentioned, but apparently they have and they didn't.

For some people the stars, planets, and moons just come together and everything works, but sadly that is not true for everyone. It would be far more helpful if, instead of just asserting that it works, you'd address some of the specific concerns I've mentioned, and/or maybe go into that thread and help some of those people. If you are a top mechanic, saying that your car runs great does not help the person whose car is stalled on the side of the road.

schnuller
Posts: 386
Joined: 2014-11-25 05:05

Re: How can I backup a Debian server to an ISO or IMG file?

#17 Post by schnuller »

I had the impression you were looking for an answer to your question.
I didn't know you want to discuss with me. My fault.
Tell me more bout that mechanic you had problems with. What experiences did he have with the moon?

User avatar
RU55EL
Posts: 546
Joined: 2014-04-07 03:42
Location: /home/russel

Re: How can I backup a Debian server to an ISO or IMG file?

#18 Post by RU55EL »

I am sorry if I can't suggest something to do exactly what you want. So, I will explain some of what I do. I don't back up entire systems; the likelyhood of the hardware failing is not that great. If there is important data that I want safeguarded, I create an alias command using rsync to backup whatever data I want to another hard drive or computer. If there is a failure, it may require reinstalling the operating system, but because that is not a common event I don't have any problem spending the time to rebuild the system, then rsync the data back from it's backup source. If the system is mission critical, such as a server, I configure it with software RAID 0. That way there is always a "backup" of everything, all the time. I know this doesn't help much with your current situation, but it is something to keep in mind next time you set up a server.

Debra
Posts: 6
Joined: 2014-11-29 23:04

Re: How can I backup a Debian server to an ISO or IMG file?

#19 Post by Debra »

schnuller wrote:I had the impression you were looking for an answer to your question.
And the only "answer" you gave was that a particular piece of software works for you. It's one of those technically accurate, but not very helpful answers.
schnuller wrote:I didn't know you want to discuss with me. My fault.
I don't, and it was. Please remember what forum you are in. This is supposed to be a forum for beginners like myself. If you are not willing to give a little bit extra in the way of help and assistance then perhaps you should refrain from answering posts here, and go hang out with the experts, who will no doubt appreciate your extraordinary intelligence.
schnuller wrote:Tell me more bout that mechanic you had problems with. What experiences did he have with the moon?
If you didn't get the point of that analogy, then you are not as smart as you think you are.

Uninformative "answers" of the type you gave, and the relative difficulty of installing packages such as that one, are part of the reason why some people who are starting out in in a non-GUI version of Linux have so much trouble getting a foothold. I had heard about the problems beginners have in getting truly useful help in Linux forums, now I see what they were talking about. I know guys who tried Linux and went back to Windows or who bought a Mac, just because they never ran into this sort of difficulty getting help with those systems.

My participation in this is finished as of now - I have been given a lot to think about and I do appreciate all the suggestions, but ultimately I think the package I will wind up using is Redo Backup. It's not what I wanted because it won't do automatic backups on a schedule, and I have to shut down the server to do a backup, and it won't let me exclude directories, but its one shining advantage is that it is easy to use and there are no complicated install instructions - you don't need to be a programmer to figure it out. It's similar to Clonezilla, but from what I have read, it appears that people have fewer problems and a higher rate of success with Redo Backup than with Clonezilla. I probably won't be able to give it a try until at least this weekend, but I am hopeful that it will at least be an interim solution.

I wish there were an easy backup solution that could be easily installed using apt-get (so that it picks the correct version automatically and brings in any dependencies automatically), and that would then let you configure it using configuration files or a simple menu driven setup, and then allow you to run it from from a command line or cron job, and it would do the backup to an ISO file on an external drive or memory stick. There are a couple of easy to install and configure backup solutions for Debian if you have a desktop installed, but as far as I can tell, nothing like that for command line only users.

User avatar
golinux
Posts: 1579
Joined: 2010-12-09 00:56
Location: not a 'buntard!
Been thanked: 1 time

Re: How can I backup a Debian server to an ISO or IMG file?

#20 Post by golinux »

Debra wrote:
schnuller wrote:Tell me more bout that mechanic you had problems with. What experiences did he have with the moon?
If you didn't get the point of that analogy, then you are not as smart as you think you are.
Good grief. Ever consider that some things get lost in translation? I bet your German is nowhere as good as his English. ;)
Debra wrote:I wish there were an easy backup solution that could be easily installed using apt-get (so that it picks the correct version automatically and brings in any dependencies automatically), and that would then let you configure it using configuration files or a simple menu driven setup, and then allow you to run it from from a command line or cron job, and it would do the backup to an ISO file on an external drive or memory stick.
I can appreciate your frustration. I just can't get past the sense of entitlement and on-demand expectation. If you want those features that much, the Linux/open source solution would be to write it yourself or ask/sponsor/hire someone with the ability to do it. If you choose to pick up your marbles and go the 'easy' route that is your loss (and the forum's gain, I think).
May the FORK be with you!

Post Reply