I am looking for a method to backup a whole disk in case something is screwed up...  I don't even know what to install on some special devices of the server, and every time it is not the same. Would cp -a for the / directory work?Is there any program that can copy all the data of the hard disk? (like an image of the hard disk).I know that this exists at least for Windows..   The hard disk is on a RAID 1 though....  
Backup whole hard disk Linux
backup;hard disk;raid1
As already noted, there are a lot of options and which one is the best depends on your requirements.Since your systems is on RAID1, you can simply replace one disk and let your mirror rebuild itself. The removed disk can be used as a backup copy.In the past, for full system backups, I have used Ghost4Linux (aka G4L) and Mondo/Mindi. The former can save a partition image locally or remotely and the later can create bootable restore (+rescue) CDs or DVDs. Both have a ncurses gui, no need for command line usage.But many times, I just copy the whole system. I mostly use rsync but here are some options that I think it's what you're looking for.Let's assume you have two partitions, / and /var and you want a complete backup. All commands require root privileges.mkdir /mnt/origmount / /mnt/orig -o bindmount /var /mnt/orig/var -o bindThis will create a new mount point for rootfs that you can now copy without worrying for other mounted filesystems like /proc or /sys or network shares.Let's assume you have a second disk formatted with an appropriate filesystem and mounted under /mnt/backup (or an NFS on the same mountpoint). It is advised that some services should stop running, for example the mysql service or mail server, to ensure integrity of the replicated data.Each of the following commands should suffice.cp -a /mnt/orig/* /mnt/backup/rsync -a /mnt/orig/ /mnt/backup/tar -C /mnt/orig -cf - ./ | tar -C /mnt/backup -xpf -The last one is kind of overkill though. tar and rsync provide a --exclude parameter for skipping files based on pattern matching, e.g. --exclude=\*.log --exclude=var/tmp. The above commands do not use compression and you will have an exact replica of your system. You can also install grub and make the backup disk bootable.If you have limited space on your backup device or a not compatible filesystem (NTFS) or it is a CIFS mounted share, you can create a compressed tar archive.tar -C /mnt/orig -zcf /mnt/backup/mybackup_$(date -I).tar.gz ./or create a squashfs image which you can later loop mount and browse its contents like a normal filesystem.mksquashfs /mnt/orig/ /mnt/backup/mybackup.squashfsmkdir /mnt/squashmount /mnt/backup/mybackup.squashfs /mnt/squash -o loopAlso, getting a remote backup with ssh and tar or rsync. rsync requires root access to the remote server in order to preserve ownerships, permissions, device files etc. --numeric-ids is necessary for not mixing ownerships with the remote system's users.tar -C /mnt/orig -zcf - ./ | ssh user@server 'cat -> mybackup_$(date -I).tgz'rsync -aP -e ssh --numeric-ids /mnt/orig/ root@server:/path/to/backup/In most cases, a full restore will require booting with another system, preferably a Live CD, then creating/rearranging your partition scheme, coping/extracting your data back and at the installing the boot loader again.