Categories
stormux

Backup and Restore

Keeping your data safe is very important. SD cards are somewhat fragile, and like any other data storage device, they can and will eventually stop working. If you are prepared for this eventuality, however, data recovery is as simple as removing the broken card and inserting the backup.

To backup your current installation of Stormux, you will need an SD card with at least as much space as your current one. You will also need a USB card reader. Insert the backup card into the reader, and attach it to the Pi.

The backup process will completely overwrite the attached card, so it is imperative that you select the correct drive when making your backup. To list your drives, using a terminal, type the lsblk command.

[storm@stormux ~]$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1  7.5G  0 disk
`-sda1        8:1    1  7.5G  0 part [SWAP]
sdb           8:16   1 29.7G  0 disk
|-sdb1        8:17   1 43.9M  0 part
`-sdb2        8:18   1 29.7G  0 part
sdc           8:32   0  3.7T  0 disk
`-sdc1        8:33   0  3.7T  0 part /media/ext
sr0          11:0    1   96M  0 rom
mmcblk0     179:0    0 29.7G  0 disk
|-mmcblk0p1 179:1    0  100M  0 part /boot
`-mmcblk0p2 179:2    0 29.6G  0 part /

We are looking for the 32GB SD card. So, looking at the lines above, we notice the following entry:

sdb           8:16   1 29.7G  0 disk

This means, for the purposes of our backup, we need to use sdb. Stormux includes a backup script called rpi-clone. Using it, and the drive whose name in this case is sdb, backing up the installed copy of Stormux is a simple matter of typing:

sudo rpi-clone -u sdb

The -u option means the backup is unattended. You will not have to confirm you want the backup to start nor press enter to unmount the card after the backup is done. Depending on when you last did a backup, the process can take quite a while. When it is done simply remove the card containing your newly backed up data, and store it somewhere safe until you want to update the backup or replace the current one. The card will be a snapshot of your system, and will boot just like the card your are currently using.

As long as you remember to backup once a week, or after major changes to your system, you should always ae good to go. This process is much more simple than replacing a hard drive in a traditional computer.