Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 09-16-2006, 12:35 PM   #1
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian
Posts: 2,192

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
Lightbulb How to backup - an example

The question of how to backup your system comes up very frequently on these forums. I thought I would throw out an example for those who might be looking for help.

There are more ways to backup than you can shake a stick at. Below is not the best, nor the worst. Just an example that works for me. If others want to chime in with their personal backup scripts, that would be a great resource for people searching for different options/solutions.

There are some things specific to my system below that should be edited/deleted for different situations.

To backup, I run:
(1) <insert a DVD-RW in my drive>
(2) sudo mount /mnt/backup
(3) sudo /mnt/backup/
(4) sudo umount /mnt/backup

Here's the script referenced above, "/mnt/backup/" ...
# Create backup directory
DATE=`date +'%F'`
mkdir /mnt/backup/$DATE
cd    /mnt/backup/$DATE || exit 1

# Partition, filespace and mount info
fdisk -l >fdisk-l.txt
df -h    >df-h.txt
mount    >mount.txt
cp /etc/fstab fstab.txt

# Installed devices info
lsusb    >lsusb.txt
lspci -v >lspci-v.txt
cat /proc/bus/input/devices >input_devices.txt
cat /proc/bus/usb/devices   >usb_devices.txt

# System, module and boot info
uname -a >uname-a.txt
lsmod    >lsmod.txt
dmesg    >dmesg.txt
# Most people probably don't have these next two files
cp /var/log/boot bootlog.txt
cp /usr/local/etc/system_info.txt system_info.txt

# Account info
cp /etc/passwd password.txt
cp /etc/group  group.txt

# Network info
ifconfig -a >ifconfig-a.txt
netstat -nlptu | cut -c1-42,69- >netstat.txt

# LVM info - comment out this section if you don't use LVM
pvs >pvs.txt
vgs >vgs.txt
lvs >lvs.txt
pvscan >pvscan.txt
vgscan >vgscan.txt
lvscan >lvscan.txt
pvdisplay >pvdisplay.txt
vgdisplay >vgdisplay.txt
lvdisplay >lvdisplay.txt
mkdir lvm_metadata
cp /etc/lvm/backup/* lvm_metadata/.

# /proc info
cat  /proc/cpuinfo >cpuinfo.txt
cat  /proc/meminfo >meminfo.txt
find /proc/ide  -name model -type f -print | xargs cat >ideinfo.txt
find /proc/scsi -name scsi  -type f -print | xargs cat >scsiinfo.txt

# MBR and Track Zero info - modify if your HDDs are not hda & hdb
dd if=/dev/hda of=hda_mbr.bin    bs=512 count=1
dd if=/dev/hda of=hda_track0.bin bs=512 count=63
dd if=/dev/hdb of=hdb_mbr.bin    bs=512 count=1
dd if=/dev/hdb of=hdb_track0.bin bs=512 count=63

# Filesystem info - modify for your mounted filesystems
( ! cd /     || tar czvf root.tar.gz . )
( ! cd /boot || tar czvf boot.tar.gz . )
( ! cd /usr  || tar czvf usr.tar.gz .  )
( ! cd /opt  || tar czvf opt.tar.gz .  )
( ! cd /var  || tar czvf var.tar.gz .  )
( ! cd /home || tar czvf home.tar.gz . )

# Set modes and timestamps
find . -type f -print | xargs chmod 444
find . -type d -print | xargs chmod 555
find . -print         | xargs touch

# Burn a DVD - modify if your DVD burner is not hdc
growisofs -dvd-compat -Z /dev/hdc -r -v .

# All done
exit 0
Old 09-17-2006, 07:12 AM   #2
Registered: Mar 2005
Location: South Africa
Distribution: Centos, Fedora, Ubuntu desktop, IPCop
Posts: 168

Rep: Reputation: 33
My personal favorite which I install on all my client sites is scdbackup:


My preferred command is scdbackup_afio (which obviously uses afio compression) - its compression per CD/DVD when you play with the options is impressive.

Combine this with mondo & mindi:


and you have a virtually failsafe backup solution.

All kudos to the developers of the above!!!



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
Error when attempting backup with File Backup lglrgl Linux - Software 0 08-03-2006 10:38 AM
can I backup a root disk and boot from the new backup disk linuxbkp Linux - Enterprise 3 10-15-2004 06:42 PM
Selective backup to CDRW, or other backup methods. trekk Linux - Software 1 11-03-2003 02:46 PM
backup help Neomaster Linux - General 3 06-06-2003 12:02 PM
backup and update the backup file doris Linux - General 4 08-24-2002 07:26 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:27 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration