Rasperry Pi: SD Card Partitions Layout Noobs Backup Restore

If you use a raspberry pi for projects which is shipped with a 8GB SDCard it is very useful to know basics about the root, file and recovery system on the preinstalled card.

  • Major Basics about the Partitioning you find here
  • To save time the raspberry pi offers possibility to run a Full Backup if the pi is ONLINE! Cause the OS is running from RAM like Live Mode!
  • For Backup you need a USB to SDCard Reader with Adaptor Micro SD to SD, and a second SDCard i use 16GB Class 10
  • Plugin the new SDCard into the Adaptor and into the Reader and connect to the raspi USB Hub
  • Open Terminal and run  Full Backup $sudo dd if=/dev/mmcblk0 of=/dev/sda bs=1M
  • Take a Cup of Coffee and wait..~17000sec/8GB  after finish plug off the SDcard Adaptor and keep save
  • If you want to migrate from 8GB to 16Gb Card do a dd-dump and replace the Card inside the pi, after sucessful boot on the 16GB Card, you can allocate a fresh 8gb primary partition with $sudo fdisk /dev/mmcblk0 and do $sudo mkfs.ext4 /dev/mmcblk4 (cause noobs place it into 4!!)

Noobs Partition Layout:

Remark:

  • A firmware upgrade will override the recovery.img on partition_1 too
  • Prefer a full recovery reset  after a raspian version upgrade! (wheezy > jessie)
  • A Kernel Only upgrade can be runned with $sudo rpi-update NO OS UPDATE!
  • Backup can be started over SSH Login to, here you need a program called „tmux“ to hold the process online on disconnect!

WordPress: Move Blog to new URL Domain HTTP HTTPS on the MYSQL Console

Info: Today most Search Engines prefer Blogs who are offering „HTTPS“ at the URL for secure direct connects to the Websites but this results a lot of headaches to the Website Developers.

To be effective you should know:

  • You have to offer HTTPS beside HTTP
  • You should use a validated Domain Certificate, most Domain Resellers offer them for FREE
  • You should know that NOT every FREE Certificate is TRUSTED by every Browser (green closed lock symbol at the adressbar)
  • You have to Develop Websites WITH variable Format output ( PC, Tablet, Smartphone, Smart-TV, Infoboxes,)
  • Design Websites and test 3:2, 4:3, 16:9, 21:9, Formats
  • Easy readable for handicapted People
  • Easy to print to PDF (Test Print Preview Page)
  • Test with different Browsers ( IE, Firefox, Midori, Chrome, Safari, Mobile Browsers like Webview, Silk) if you have no possibilities ask Friends to test

To move the Blog you must access the MySQL Server and the Blog Database! phpMyAdmin Admin Interface should NOT be used if you can use the Terminal for higher Security! If not access the phpMyAdmin Admin Weblogin only be Local IP!!!

MySQL Server:

  • Always remove Anonymous User!
  • Always replace the root User Account with a new one
  • Always use very long Database Passwords! minimum 12 digits !
  • Set if you can the Listen IP to localhost or Socket for the MYSQL Server, no one should be able to access the server via public IP. If you have a virtual Server without second IP install a Firewall like „ufw“ and block all Ports without 25, 80, 443!!

Database Changes:

  • Login to the Server via SSH and connect to the MySQL Server with $mysql -u databaseadmin -p
  • Enter following MySQL Commands:

 

mysql > use blogdatabasename;  #change to the blog database

mysql > UPDATE wp_posts SET guid = replace(guid, 'http://www.domain','https://www.domain');

mysql > UPDATE wp_posts SET post_content = replace(post_content, 'http://www.domain', 'https://www.domain');

mysql > UPDATE wp_options SET option_value = replace(option_value, 'http://www.domain', 'https://domain');

mysql > UPDATE wp_posts SET guid = replace(guid, 'http://www.domain','https://www.domain');

mysql > UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.domain','https://www.domain');

mysql > flush query cache; #force updates on the mysql server caches!

mysql > quit;

Testing:

  • Login into your Blog on WordPress and check results and view, save and change all basics settings again on area settings an reading, cause much files are often „cached“ by Browsers, Proxy’s or by Cache Plugins!
  • Change wp-config.php add this „define(‚FORCE_SSL_ADMIN‘, true);“ to force https for Admin Login.
  • Check the Widgets! Cause you can’t change all URL’s at the MySQL Database, cause the Widgets creates „dynamic“ URL-Path Entry’s!!!