jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

backup and restore apps

Sat Aug 01, 2015 6:36 pm

Hi,
could you please suggest a tool to back up installed apps eg(libreoffice) to pen drive and restoring it later.
i have tried to download aptik,but failed.thanks ;)

User avatar
rpdom
Posts: 18733
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: backup and restore apps

Sat Aug 01, 2015 6:43 pm

Do you mean to backup all of the installed files from all directories, or to backup the original install file, or backup any data?

The easiest thing to do is to take a copy of the .deb file that the package was installed from, as that is essentially just a backup of all the files needed, plus package information and some configuration scripts.

You can find the .deb files in /var/cache/apt/archives/ as long as you haven't done an "apt-get clean" to get rid of them.

klricks
Posts: 7785
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: backup and restore apps

Sat Aug 01, 2015 8:14 pm

jino wrote:Hi,
could you please suggest a tool to back up installed apps eg(libreoffice) to pen drive and restoring it later.
i have tried to download aptik,but failed.thanks ;)
Being vigilant and persistent about making backups of files that you have created with your apps is essential. These files can easily be saved to a USB 'stick' or other network attached storage.

However IMO making backups of installed apps is pointless when it is so easy to uninstall, install or reinstall apps using the normal methods: apt-get commands or using a package manager program.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: backup and restore apps

Sat Aug 01, 2015 11:09 pm

jino wrote:Hi,
could you please suggest a tool to back up installed apps eg(libreoffice) to pen drive and restoring it later.
i have tried to download aptik,but failed.thanks ;)
I use the following to backup my PIs to my NAS:

Code: Select all

sudo rsync -avz --delete --exclude /sys --exclude /tmp --exclude /proc --exclude /run / pis@omv.local:/PIs/`hostname`/
After the initial run, it's just an incremental and takes no time at all. This will preserves all your config files which reinstalling a package might not do.

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Sun Aug 02, 2015 9:46 am

rpdom wrote:Do you mean to backup all of the installed files from all directories, or to backup the original install file, or backup any data?

The easiest thing to do is to take a copy of the .deb file that the package was installed from, as that is essentially just a backup of all the files needed, plus package information and some configuration scripts.

You can find the .deb files in /var/cache/apt/archives/ as long as you haven't done an "apt-get clean" to get rid of them.
Hi,
I want to backup install file for each application.When i go to the var/cache/apt/archives/ folder i can see the files but its all mixed up.It would be nice if i could see packages sorted by the application,so that i can know which one to restore,later.

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Sun Aug 02, 2015 9:50 am

klricks wrote:
jino wrote:Hi,
could you please suggest a tool to back up installed apps eg(libreoffice) to pen drive and restoring it later.
i have tried to download aptik,but failed.thanks ;)
Being vigilant and persistent about making backups of files that you have created with your apps is essential. These files can easily be saved to a USB 'stick' or other network attached storage.

However IMO making backups of installed apps is pointless when it is so easy to uninstall, install or reinstall apps using the normal methods: apt-get commands or using a package manager program.
Hi,
its true but if i do a backup i do not need to type in terminal for each app ,later when re installing ;)

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Sun Aug 02, 2015 9:53 am

asandford wrote:
jino wrote:Hi,
could you please suggest a tool to back up installed apps eg(libreoffice) to pen drive and restoring it later.
i have tried to download aptik,but failed.thanks ;)
I use the following to backup my PIs to my NAS:

Code: Select all

sudo rsync -avz --delete --exclude /sys --exclude /tmp --exclude /proc --exclude /run / pis@omv.local:/PIs/`hostname`/
After the initial run, it's just an incremental and takes no time at all. This will preserves all your config files which reinstalling a package might not do.
Hi ,
i think this backups the whole raspbian image.am i right?
i just need apps to back up/

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Sun Aug 02, 2015 9:54 am

update:can i use synaptic package manager for backup?

User avatar
rpdom
Posts: 18733
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: backup and restore apps

Sun Aug 02, 2015 10:03 am

jino wrote:
rpdom wrote:You can find the .deb files in /var/cache/apt/archives/ as long as you haven't done an "apt-get clean" to get rid of them.
Hi,
I want to backup install file for each application.When i go to the var/cache/apt/archives/ folder i can see the files but its all mixed up.It would be nice if i could see packages sorted by the application,so that i can know which one to restore,later.
I don't understand "all mixed up". They have the application in their name. To see the php install files, for example, I would

Code: Select all

pi@raspi3 ~ $ cd /var/cache/apt/archives
pi@raspi3 /var/cache/apt/archives $ ls *php*.deb
php5-cli_5.6.9+dfsg-0+deb8u1_armhf.deb
php5-common_5.6.9+dfsg-0+deb8u1_armhf.deb
php5-mysql_5.6.9+dfsg-0+deb8u1_armhf.deb
php-mail_1.2.0-7_all.deb

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Sun Aug 02, 2015 6:27 pm

^^^ i mean,for example ,if i want to isolate libre office package files to restore it later, there are a bunch of files like
libreoffice-core_1%3a3.6.1-1+rpi1_armhf
libreoffice-common_1%3a3.6.1-1+rpi1_all
libreoffice-writer_1%3a3.6.1-1+rpi1_armhf


etc..so should i put all files strting with libre office in to a folder?
I dont know how it works , not like .exe files in windows :lol:

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: backup and restore apps

Sun Aug 02, 2015 6:40 pm

Yes, all of those are packages, so the LibreOffice program is separated into multiple packages.

In the end, you're going to have to install them anyways.

Why not just list all the programs that are installed and apt-get install them again. Much simpler
There are 10 types of people: those who understand binary and those who don't.

User avatar
rpdom
Posts: 18733
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: backup and restore apps

Sun Aug 02, 2015 6:48 pm

kusti8 wrote:Why not just list all the programs that are installed and apt-get install them again. Much simpler
+1

Especially as all the libreoffice packages may depend on other packages needing to be installed as well.

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Mon Aug 03, 2015 7:58 pm

hmm..now it seems better to do apt get rather than installing packages one by one :D ..thanks all

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: backup and restore apps

Tue Aug 04, 2015 6:25 pm

jino wrote: Hi ,
i think this backups the whole raspbian image.am i right?
i just need apps to back up/
The parameters that I have used do backup the whole image (only once, the next time it runs only the differences will be actioned) but you can alter them to suit your needs, for example just /home/pi for your stuff or /usr for non-core programs (ie files in /bin or /sbin)

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Wed Aug 05, 2015 7:07 am

asandford wrote:
jino wrote: Hi ,
i think this backups the whole raspbian image.am i right?
i just need apps to back up/
The parameters that I have used do backup the whole image (only once, the next time it runs only the differences will be actioned) but you can alter them to suit your needs, for example just /home/pi for your stuff or /usr for non-core programs (ie files in /bin or /sbin)
hi thats good.So if i want to back up my home folder how do i do it.I understood the last part of the command - its to your NAS.so to back up the home folder to my pendrive ,will the command be like this? sda1 is pendrive
sudo rsync /pi/home -avz --delete --exclude /sys --exclude /tmp --exclude /proc --exclude /run / dev/sda1

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: backup and restore apps

Wed Aug 05, 2015 12:02 pm

If you're backing up your home directory there is no need to exclude /sys, /tmp, /proc, and /run as they don't exist in your home directory anyway. I use rsync to create two backups, one is /home only and the other is everything except /home. And if you have a lot of things to exclude, like when backing up the whole system it's easier to use an "exclude" file rather than a lengthy list of excludes in the rsync line.

Mine backs up to a USB flashdrive that is mounted at ~/Desktop/usbdrv. I have two directories on the flashdrive to contain the two backups, "home" and "all".

To back up /home I use this in crontab:

Code: Select all

/usr/bin/rsync -a -- delete --exclude-from '/home/pi/exclude-home.txt' /home/pi /home/pi/Desktop/usbdrv/home/
It backs up everything in /home/pi to a USB flashdrive mounted at /Desktop/usbdrv. The "exclude-home.txt" file contains the following:

Code: Select all

network-folder
.xsession-errors
/usbdrv/*
lost+found
I exclude the mount point /usbdrv/ where the backup is being written so it won't get into a circular reference and start backing up the backup. I also exclude "network-folder" which is a mounted share from a NAS, no need to back that up on the Pi.

To backup the entire system, except /home I use this in crontab:

Code: Select all

/usr/bin/rsync -a --delete --exclude-from '/home/pi/exclude-full.txt' / /home/pi/Desktop/usbdrv/all/
And the "exclude-full.txt" contains the following:

Code: Select all

/proc/*
/sys/*
/dev/*
/tmp/*
/run/*
/mnt/*
/media/*
/home/*
fake-hwclock.data
ntp.drift
auth.log
kern.log
lastlog
messages
syslog
wtmp
The "*" tells it to create the directory in the backup, but leave it empty. The first backup will take a while as all the files have to be copied to the backup. After that the daily backup only takes about 20~30 seconds to update, unless I've installed some new software and it has copy a lot of new files.

User avatar
rpdom
Posts: 18733
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: backup and restore apps

Wed Aug 05, 2015 2:10 pm

I tend to back up by file system, so when I use rsync I add the -x option, which stops it from backing up /sys, /dev, /proc and others like that. It means my exclude list is minimal.

I actually use the "dump" command to back up most of my systems. It may be old and a bit basic, but it handles incremental backups well and it generally works ok. It has saved me from a lot of bother a few times in the past, like on the couple of occasions when my laptop hard disk failed - new disk, restore from DVD, reset grub, back running in under an hour.

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: backup and restore apps

Wed Aug 05, 2015 2:55 pm

Dump is old, I think it's been around since the beginning of the epoch. :D
I still use dump on FreeBSD. It's running a ZFS filesystem so I take a snapshot first, then use dump to backup the snapshot.

For the Pi storage space is a bit more limited, and I don't want to backup log files and such, so I always have an exclude file for rsync anyway.

jino
Posts: 15
Joined: Wed Jul 08, 2015 12:04 pm

Re: backup and restore apps

Wed Aug 05, 2015 7:16 pm

thanks JimmyN for the detailed answer :D

LopezCanepa
Posts: 2
Joined: Mon Apr 17, 2017 4:39 pm

Re: backup and restore apps

Mon Apr 17, 2017 5:05 pm

Hi All,

After the last upgrade of Raspbian, my system failed with no apparent way of recover.
In this events reinstalling flashing the card is not to painful, but it takes some time.
Reinstalling all the software and services is easy as mentioned in this forum, it just takes some time and a list of what you have installed. I normally use four computers, with my Rasberry 3 as server and sync provider.
What is really painful and extremely time consuming (in my case over two days) is to reconfigure all the services, the mail notification of events and getting every thing to work again.
I will now make a copy of my card in a second card, just in case, but i can not stop the server to extract the card to update the changes. However, a better solution to start from scratch.
This is how goggling around i found Aptik, that looked promising, but apparently not available for Raspbian.

If any one would have a good solution to back up and restore all configuration files, please let me know.
Thanks and best regards to all,
Carlos.

Raspberry pi3, 4 ubuntu boxes for engineering work.

fruitoftheloom
Posts: 26872
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: backup and restore apps

Mon Apr 17, 2017 5:44 pm

LopezCanepa wrote:Hi All,

After the last upgrade of Raspbian, my system failed with no apparent way of recover.
In this events reinstalling flashing the card is not to painful, but it takes some time.
Reinstalling all the software and services is easy as mentioned in this forum, it just takes some time and a list of what you have installed. I normally use four computers, with my Rasberry 3 as server and sync provider.
What is really painful and extremely time consuming (in my case over two days) is to reconfigure all the services, the mail notification of events and getting every thing to work again.
I will now make a copy of my card in a second card, just in case, but i can not stop the server to extract the card to update the changes. However, a better solution to start from scratch.
This is how goggling around i found Aptik, that looked promising, but apparently not available for Raspbian.

If any one would have a good solution to back up and restore all configuration files, please let me know.
Thanks and best regards to all,
Carlos.

Raspberry pi3, 4 ubuntu boxes for engineering work.
PiClone (included in Raspbian Jessie with Pixel) can make a 'clone' to a SD Card in a USB Card Reader of a 'live' system:

https://github.com/raspberrypi-ui/piclo ... ter/README
The information is out there....you just have to let it in.

My other Linux machines: ChromeBox
https://www.aliexpress.com/item/32966393971.html
& Stone Desktop Intel CoreDuo circa 2010

LopezCanepa
Posts: 2
Joined: Mon Apr 17, 2017 4:39 pm

Re: backup and restore apps

Tue Apr 18, 2017 7:44 pm

That is excellent news, thank you!!

Return to “Beginners”