Backup your SlackPi

The SARPi project forum. For anything and everything relating to Slackware ARM on a Raspberry Pi 1, 2, and 3. This forum is NOT a replacement or substitute for the Slackware (ARM) forums on Linux Questions website! Please try to seek help there first about any issues you may be experiencing, or question you might have, before posting on here.
User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Backup your SlackPi

Postby linicks » Sun Nov 23 2014 - 18:36:47

Just tested this today.

OK, so you have a nice new tweaked Raspberry Pi running Slackware. Here's how to back it up easily.

Shutdown the Pi properly:

Code: Select all

shutdown -h now


Remove the SD card and connect it to another Slack (or GNU/Linux) box machine - do NOT mount the card.

Check /var/log/messages and see what device it is hooked to - i.e. that could be /dev/sdb or /dev/sdc etc : after finding that out, create a directory to create the SD card image, i.e. (in home directory) mkdir slackpibckup

Now create the image:

Code: Select all

dd if=/dev/sdx of=/path/to/image


/dev/sdx == what the device is... in this example /path/to/image will be the directory created in your home directory. I called my image 'slack.image'. This will take a few minutes.

When done, just pull the card and get your Pi up and running again.

Now, to clone a copy, get another SD card THE SAME SIZE as the copied one.

Insert it into the machine you already copied the Pi SD from and issue (again DO NOT MOUNT IT):

Code: Select all

dd if=/path/to/image of=/dev/sdx


Remember the sdx device is what the system sees it as and the path is where you created the original image. This will take a while - for me, about 25 minutes. When done, you will have a cloned SD card of your nice SlackPI system. To test, shutdown the Pi and swap over the cards - it will boot and be an exact replica of your system.

Once done, put it away... if anything ever happens, you can now get SlackPi up and running again in a few minutes.

Also you can use this to quickly make a new SD card for any new Raspberry Pi boards.

Nick :)
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 204
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: Backup your SlackPi

Postby Exaga » Thu Nov 27 2014 - 10:36:40

linicks wrote:

Code: Select all

dd if=/dev/sdx of=/path/to/image

/dev/sdx == what the device is... in this example /path/to/image will be the directory created in your home directory. I called my image 'slack.image'. This will take a few minutes.

Nick :)


It's worth noting that not all SD cards are exactly the same capacity and (much to my annoyance) most of the time the image I've created using this method always seems to be a little larger than the card capacity I am writing to.

Also, I use this when making an image:

dd if=/dev/sdX of=/path/to/image conv=noerror,sync bs=2M

The conv=noerror means carry on even if errors are found. The bs=2M speeds up the process dramatically. I've also used bs=4M but there doesn't seem to be much difference in it on the Raspberry Pi.
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: Backup your SlackPi

Postby linicks » Thu Nov 27 2014 - 21:09:36

Exaga wrote:It's worth noting that not all SD cards are exactly the same capacity and (much to my annoyance) most of the time the image I've created using this method always seems to be a little larger than the card capacity I am writing to.

Good point. I bought the same SD Card from the same shop to create my clone, so that is why it worked OK.

Maybe would be wise to buy a batch of 5 all at once for doing this sort of thing.

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: Backup your SlackPi

Postby linicks » Sun Aug 09 2015 - 11:31:36

Exaga wrote:
It's worth noting that not all SD cards are exactly the same capacity and (much to my annoyance) most of the time the image I've created using this method always seems to be a little larger than the card capacity I am writing to.



I just hit this. My Pi B2 keeps mysteriously locking up between 4 to 6 days (and absolutely nothing in the logs - even an attached monitor has no signal), and after trying everything (including a USB ethernet adaptor), I decided the board was bad, so bought a new Pi B2. That locks up the same!

So I am trying a new SD card - and of course the image is too big for it - gparted reports the old card is 14.93GB and the new card 14.64.

So I down sized the partition, and the used dd count=14802500. This worked perfectly!

df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p3 14G 4.8G 8.4G 37% /
tmpfs 463M 0 463M 0% /dev/shm

But here's a question that has me stumped.

On the old image that I copied raw, the image on disc is:

15653892 -rw-r--r-- 1 n1ck users 16029581312 Jul 26 11:27 sauron.image

but using the dd option of count, the size is:

7401256 -rw-r--r-- 1 n1ck users 7578880000 Aug 9 09:30 sauron_reduced.image

? well smaller - yet as you can see from above, dd still wrote 14GB

Weird or what?

Anyway, lets hope it was the card, else I might need to start a new thread about these strange lock-ups.

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

User avatar
Exaga
FatDog Network Administrator
FatDog Network Administrator
Posts: 204
Joined: Wed Apr 18 2012 - 02:01:03
Location: England [UK]

Re: Backup your SlackPi

Postby Exaga » Mon Aug 10 2015 - 22:00:36

hehe nice one Nick :ok:
Exaga

====
__ KEEP THE DOG ALIVE!!!
()'`; /
/\|` W00f W00f W00f
www.fatdog.eu

User avatar
linicks
Registered user
Registered user
Posts: 126
Joined: Mon Oct 27 2014 - 20:26:01
Location: Pompey, England

Re: Backup your SlackPi

Postby linicks » Tue Aug 11 2015 - 20:27:30

I think* I may have found why both the Pi2's just die without anything in the logs.

Since using the new SDCard, I saw this in the logs today:

/var/log/messages:

Code: Select all

Aug 11 10:14:06 sauron kernel: [172660.791182] EXT4-fs (mmcblk0p3): error count
since last fsck: 2
Aug 11 10:14:06 sauron kernel: [172660.791229] EXT4-fs (mmcblk0p3): initial error at time 1439197808: mb_free_blocks:1450: block 1809969
Aug 11 10:14:06 sauron kernel: [172660.791253] EXT4-fs (mmcblk0p3): last error at time 1439197808: ext4_mb_generate_buddy:757


and this in /var/log/syslog:

Code: Select all

Aug 10 10:10:08 sauron kernel: [86022.544960] EXT4-fs error (device mmcblk0p3):
mb_free_blocks:1450: group 55, block 1809969:freeing already freed block (bit 77
29); block bitmap corrupt.
Aug 10 10:10:08 sauron kernel: [86022.554976] EXT4-fs error (device mmcblk0p3):
ext4_mb_generate_buddy:757: group 55, block bitmap and bg descriptor inconsistent: 25143 vs 25144 free clusters


Ummm. This could be the result of repartitioning and putting on a new card, but I dunno, as it's been running for two days now, and only once has this error turned up (maybe something trying to wirte to the 'bad blocks?'). I fixed using this advice 'create a directory /forcefsck' and e2fsck will run at boot from here:

http://www.cyberciti.biz/faq/linux-forc ... -sequence/

*Now, whether this is _the_ issue, I don't know, but it would explain the symptoms of a bad card having a dodgy error and the kernel just crashes - by just cloning it I copyed the file corruption, but the new card is more resilient/and or the blocks corrupted now do not contain files that crash the thing as they all moved about a bit.

I think... :D

Lets see if it stays up now, although no lock-ups so far.

Nick
https://linicks.net/

Q. What is the difference between a duck and an elephant?
A. You can't get down off an elephant.

Return to “SARPi Project - Slackware ARM on a Raspberry Pi”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 4 guests