TUTORIAL Experimental: copy Raspberry Pi IPBX live to sd-card

svangool

New Member
Joined
Jul 23, 2014
Messages
13
Reaction score
5
  • This procedure is heavily based on the article of Matt Hoskins ( http://sysmatt.blogspot.nl/2014/08/backup-restore-customize-and-clone-your.html ) and the IPBX environment of Ward Mundy
  • Although this was tested to function fine, copying from a running system can fail !
  • As Matt points out in his article, the procedure can be scripted.
  • It is recommended to perform below procedure in a limited time interval, so it won't be interfered with IPBX, FPBX or Raspbian/Debian updates
Code:
## insert USB card reader (I prefer micro sd -card) with inserted SD-card in USB slot of RPI (can be one of those cheap micro SD USB key-ring readers)
apt-get update ## To be sure that your system is up-to-date, do also check if there are no FreePBX modules pending in FreePBX "Admin/Module admin"
apt-get upgrade
apt-get install dosfstools
dmesg ## lookup which device was added when SD was inserted e.g. /dev/sda
parted /dev/sda ## the usage of sda, sda1 and sda2 here and below, is dependant of the above outcome of dmesg
  mklabel msdos
  mkpart primary fat16 1MiB 64MB
  mkpart primary ext4 64MB -1s
  print
  quit
mkfs.vfat /dev/sda1
mkfs.ext4 -j /dev/sda2
mkdir /tmp/newpi
mount /dev/sda2 /tmp/newpi
mkdir /tmp/newpi/boot
mount /dev/sda1 /tmp/newpi/boot
df -h ## check the new mounts are there and that your current usage fits on the new ext4 partition
service apache2 stop
amportal kill
ps aux|grep /usr/sbin/asterisk|grep -v grep ##If this is still giving a result, try "amportal kill" once more
service mysql stop
top ## check that there are no heavy processes active anymore
/root/clear-cache
/root/clear-logs
rsync -av --one-file-system / /boot /tmp/newpi/
df -h ## check the new partitions, they should contain the copy now
umount /tmp/newpi/boot ## includes sync;sync;sync;
umount /tmp/newpi
e2fsck -f /dev/sda2 ## check ext4 file system integrity
service mysql start
service apache2 restart
amportal start
 

Members online

Forum statistics

Threads
25,825
Messages
167,852
Members
19,250
Latest member
mark-curtis
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top