Daniels Blog
30Sep/220

Small SMS to Email gateway with Tasker, Android and a webserver

I wanted to forward SMS text messages to email. Tasker has an email action, but it won't automatically send the email, just provide the composing window.

Gladly Tasker can do HTTP-requests and read SMS, so we can forward the SMS to our own webserver to mail it from there.

 

Tasker part:

  • Create Profile "Incoming SMS"
  • Make it run Task "SMS2Email" when Event "Received Text SMS" is triggered.

 

  • Create new Task "SMS2Email"
  • In Task "SMS2Email:
  • Make sure mobile data is turned on
  • Do the following HTTP POST Action:

Server: https://www.myserver.com

Path: smsgateway.php

Data / File: sms=%SMSRF / %SMSRN / %SMSRB / %MMSRS / %SMSRD / %SMSRT

Trust any certificate: check

 

Webserver part on www.myserver.com:

# /var/www/smsgateway.php
<?php
$sms = $_POST["sms"];
$sms_parts = explode("/", $sms);

$sms_num = $sms_parts[0];
$sms_nam = $sms_parts[1];
$sms_txt = $sms_parts[2];
$sms_dat = $sms_parts[4];
$sms_tim = $sms_parts[5];

$body ="
$sms_dat $sms_tim
$sms_num
$sms_nam

$sms_txt
";

mail("targetemail@myserver.com", "SMS $sms_nam $sms_num", $body, "From: Snappy Sendername <smsservice@myserver.com>");
?>

Here we go. After receiving a SMS, Tasker makes the HTTP-request, delivering the content of the SMS to the webserver. PHP sends the content out by mail.

If you don't want to forward all SMS, you can add additional filters in Taskers event "Received Text SMS".

Make sure your PHP setup is able to deliver mail. Check if messages go to spam.

veröffentlicht unter: Android, Linux keine Kommentare
26Dez/190

TUXEDO InfinityBook Pro 14 v5 with Arch Linux


I had a few problems making Arch work properly with the Tuxedo InfinityBook Pro 14 v5.
I will share my problems and fixes here.

Constant high CPU load on one core
After boot one CPU core constantly jumped up to 42% and kept staying there. This drove the fan to insane RPM and drained the battery quickly. I debugged this by checking what caused the load. Using top revealed, that all the load was sys load, which is caused by the kernel. So I checked kernel stats with nmon which brought me to the conclusion, that the problem was related to IRQ. A quick cat /proc/interrupts showed me, that the core in question was taken hostage by tpm0 which is the kernel module for the Trusted Platform Module which I never knowingly used. I disabled loading of the module by blacklisting it. I am not quiet sure if this has any bad consequences but I haven't noticed anything yet. Without the module loaded, the core instantly went back to normal.

cat /etc/modprobe.d/blacklist.conf

blacklist tpm
blacklist tpm_tis
blacklist tpm_crb
blacklist tpm_tis_core

Settings for i915 driver (Intel UHD620 integrated graphics)
I guess there is a lot more tuning possible, but this basic setup works fine for me.
Good documentation can be found here.

cat /etc/default/grub | grep GRUB_CMDLINE_LINUX_DEFAULT

GRUB_CMDLINE_LINUX_DEFAULT="i915.enable_fbc=1 i915.enable_guc=-1 i915.fastboot=1"

DisplayLink output via Thunderbolt3 port
To enable DisplayLink via the Thunderbolt3 port this BIOS setting needs to be set:
BIOS -> Advances chipset setup -> DDI -> DDI to TBT

After that the instructions from the Arch Wiki made my external screen connected via USB-C work. Follow the instructions for USB3 DisplayLink devices.

Disabling internal microphone
One of the features that are important to me is the possibility to disable the internal mic of the device.
A little bit of paranoia is always good. I bought the device believing that this will be possible directly from the BIOS,
because TUXEDO states this in it's product description. The option is available in the BIOS, but it was a big disappointment.
You actually *can* disable the mic, but not without disabling sound *output* as well. Basicly the whole intel audio chip is being turned off. This is no option, so I wrote a little script as a dirty workaround, that mutes the internal mic every second. I might just disconnect the cables in the future but right now I am not into disassembling the device.

#!/bin/bash

while [ 1 ]; do
amixer set Capture nocap
amixer set Capture 0%
sleep 1
done;

Suspend (sleep) on closing the lid
I wanted the notebook to suspend when the lid is closed. XFCEs builtin power manager did not work out of the box. I read that it could interfere with systemds builtin power manager, so i uninstalled it:

pacman -R xfce4-power-manager

I experiemented with many different kernel parameters, until i found the one that worked (acpi_osi=Linux):

cat /etc/default/grub | grep CMD_LINE
GRUB_CMDLINE_LINUX_DEFAULT="i915.enable_fbc=1 i915.enable_guc=2 i915.fastboot=1 acpi_osi=Linux"

I am unsure if i really needed to do this, but I uncommented a line in systemds sleep.conf

cat /etc/systemd/sleep.conf

[Sleep]
SuspendMode=suspend

Finaly i configured systemds logind.conf

[Login]
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend
LidSwitchIgnoreInhibited=yes

Now the device suspends on every lid close and wakes up again after opening the lid.

veröffentlicht unter: Linux keine Kommentare
20Mrz/190

Create binaural beats on the fly on the linux command line

I was looking for a quick way to generate binaural beats on the fly from the Linux console.
The "play" command from the sox package makes things pretty easy.

This is my little wrapper script for "play":

#!/usr/bin/php
<?
# binaural - wrapper script to create binaural beats on the fly 

if (!$argv[1])
{
echo "Binaural beat generator\n";
echo "Usage: binaural basefreq offset length(s)\n\n";
exit;
}


$freq2 = $argv[1] + $argv[2];

$cmd = "play -n synth $argv[3] sin $argv[1] sin $freq2";
echo $cmd;
echo "\n\n”";
passthru($cmd);
?>

So for example if you want to generate a 5 minute binaural sound for the Schumann resonance (7.8HZ) with a base frequency of 120HZ, you would use:

binaural 120 7.8 300

A very comprehensive guide to the different frequencies can be found here:

Frequency List

veröffentlicht unter: Linux keine Kommentare
24Nov/160

Simulating a bad connection / packet loss with iptables

This will randomly drop 60% of outgoing packages with a local process as source.
Use it for testing purposes or if you need a good laugh.

#!/bin/bash
iptables -A OUTPUT -m statistic --mode random --probability 0.6 -j DROP
veröffentlicht unter: Linux keine Kommentare
24Nov/160

Iptables revised

640px-hilofilter-agr

Just a backup of the updated iptables setup for my gateway box:

[CABLE MODEM] - [eth0 GATEWAY eth1] - [LAN SWITCH] - - - [CLIENTS]

Thanks to O'Reilly for this great book that helped me a lot: Linux iptables Pocket Reference

#!/bin/bash                                                                                                                                                   
                                                                                                                                                        
wan_nic=eth0                                                                                                                                
lan_nic=eth1                                                                                                                                 
lan_nic_ip=192.168.1.69                                                                                                                     
lan_network=192.168.1.0/24                                                                                                                                                                                                                                                                                    
# PORT MAPPING FUNCTION
MAP(){
iptables -A PREROUTING -t nat -i $wan_nic -p $1 --dport $2 -j DNAT --to $3:$4
echo "PORTMAP: Mapped a port. localhost:$2 ($1) -> $3:$4 [$5]"
}


# Del old rules
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F 
echo "Deleted old rules"

# Default Policies
#iptables -P PREROUTING ACCEPT
iptables -P FORWARD ACCEPT
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
#iptables -P POSTROUTING ACCEPT
echo "Set default policies"

# Enable NAT
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Enabled ip_forward in kernel"

###### INPUT LOCAL

# FROM EVERYWHERE
iptables -A INPUT -p icmp -j ACCEPT

# FROM LOCAL TO LOCAL
iptables -A INPUT -i lo -j ACCEPT

# FROM LAN TO LOCAL

# Needed for DHCP clients (no ip yet so allow interface, not ip range)
iptables -A INPUT -i $lan_nic -j ACCEPT

# Allow LAN TO LOCAL
iptables -A INPUT -s $lan_network -j ACCEPT

# ALLOW PACKAGES SENT FROM GW TO WAN TO COME BACK
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# FROM WAN TO LOCAL
iptables -A INPUT ! -s $lan_network -j DROP

echo "Configured INPUT CHAIN"

###### OUTPUT LOCAL (done with default policy)
# FROM LOCAL TO LAN
# FROM LOCAL TO WAN
# FROM LOCAL TO LOCAL

###### FORWARD
# FORWARD FROM LAN TO WAN


# LOCK BAD CLIENTS IN LAN
#SONY TV
iptables -A FORWARD -s 192.168.1.20 -j DROP
#NETGEAR
iptables -A FORWARD -s 192.168.1.100 -j DROP
#DLINK
iptables -A FORWARD -s 192.168.1.101 -j DROP

echo "Configured FORWARD chain"


# FORWARD FROM WAN TO LAN

# NAT the LAN
/sbin/iptables -t nat -A POSTROUTING -o $wan_nic -j MASQUERADE

echo "Enabled MASQUERADEing"

# Don't forward unrelated packages from the outside
iptables -A FORWARD -i $wan_nic -m state --state INVALID -j DROP 

echo "DISABLED FORWARDING for connections from the outside"

# Portmappings from WAN to LAN
MAP tcp 80    192.168.1.2 80  SRV_HTTP




# FINALIZE

/etc/init.d/networking restart
echo
echo
dhclient -v eth0
echo 
echo
ping -c1 134.99.128.2
echo
echo
ping -c1 192.168.1.2

echo
echo 
echo "done"

veröffentlicht unter: Linux keine Kommentare
8Nov/160

IP-Adressen in Apache Logfiles anonymisieren mit PipedLogs

Ich hatte gestern eine Aufgabe, für die ich zunächst keine einfache Lösung gesehen habe: Ich wollte in den Apache-Logfiles die IP-Adressen anonymisieren. Also aus den geloggten IP-Adressen Teile entfernen um noch ein rudimentäres Logging der einzelnen Besucher zu haben, aber nicht mehr ihre kompletten IPs mitzuschreiben.

So sollte aus einer 212.122.113.145 eine ***.***.*13.145 werden.
Dies sollte - um möglichst grosse Sicherheit zu garantieren - nicht nachträglich geschehen, sondern live im Logvorgang des Apache.
Es sollten also niemals die kompletten IPs auf der Platte landen

Nach etwas Recherche bin ich auf eine mir bis dahin unbekannte Apache-Funktionalität gestossen: PipedLogs.

PipedLogs ermöglichen es in der Apachekonfiguration für einen VirtualHost nicht einen Logfile anzugeben sondern ein Skript festzulegen, das bei jedem Logvorgang gestartet wird und als Standardeingabe die Logzeile vom Apache erhält.

In der Config vom entsprechenden VirtualHost sieht das Ganze so aus:

LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "|/root/scripts/anonymize_apache" common

Jeder Logentry wird somit durchgereicht an das Script /root/scripts/anonymize_apache

Der Rest ist nur noch eine Kleinigkeit mit der BASH:

#!/bin/bash

#/root/scripts/anonymize_apache

# Von Standardeingabe lesen
read logline

# Mit sed die gewünschten Teile der IP wegschnippseln
anon=$(echo $logline | sed -r 's/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]/***.***.*/g'  )

# Das Ergebnis anonymisiert ins Logfile zurückschreiben 
echo $anon  >> /var/log/apache2/myvirtualhost.anon.log

Edit: Habe nach dem Verfassen des Artikels ein Skript gefunden, das mehr Funktionalität bietet als mein Dreizeiler:
https://www.privacyfoundation.ch/de/service/anonip.html

veröffentlicht unter: Linux keine Kommentare
5Okt/150

LPIC 101 Lernvideos

Ich hatte schon seit ewigen Zeiten vor endlich mal LPIC2 zu machen. Die 201 habe ich bereits vor einigen Jahren bestanden und es bisher immer verklüngelt die 202 zu machen. Irgendwie hat man ja in seiner Freizeit (fast) immer was besseres zu tun 😉 Trotztdem dachte ich mir, dass es doch noch ein schönes Ziel für 2015 wäre, das Ganze endlich hinter mich zu bringen.

So weit so gut. Ich habe mich also bei LPI eingeloggt um mich für die 202 anzumelden und dabei mit Schrecken festgestellt, dass mein Level 1 vor 3 Monaten abgelaufen war. Meine Hoffnung war nun, dass ich die Prüfung 202 trotzdem ablegen kann, da ich 201 bereits besitze aber dem war leider nicht so.

"Sie müssen zunächst für Level 1 zertifiziert sein um Level 2 Prüfungen abzulegen". Verdammt! Immerhin ist kein erneutes Ablegen der 201 notwendig. Trotzdem war ich natürlich alles andere als begeistert mich noch einmal durch die 1 zu quälen.

Nach einigen Tagen des Haderns habe ich mich entschlossen noch einmal LPIC1 zu machen und das Ganze mit kommentierten Lernvideos zu begleiten. Deshalb heute nach meiner bestandenen 101-400 Prüfung auch meine erste Videoserie auf YouTube. Vielleicht hilft es jemandem, der gerade auch für die 101 lernt.

Meine LPIC 101 Videos gibt es hier: Lets Learn LPIC 101 deutsch - Youtube

veröffentlicht unter: Linux keine Kommentare
30Dez/140

Debian Jessie LXC networking. Containers with public and NATed IPs

It took me some time to get this working so it's time for a blog post:

Scenario
This was a setup for a server in a data center with a public IP address. The server has one physical interface with a public routable IP address. Additionaly I ordered another public IP address for the server to be used in one of the LXC containers.

I have two containers.

Container A
"A" gets a public routable IP-address to be reachable from the internet without NATing

Container B
"B" gets a private IP address and can only be reached thru NAT and port-mappings

Host
Host has 5.5.5.1 as main public IP
Container A has 5.5.5.2 as "virtual" IP
Container B has 10.10.10.1 as NATed private IP

HOST SETUP:



#NETWORKING CONFIG ON HOST
#/etc/network/interfaces

auto lo
iface lo inet loopback


allow-hotplug eth0
iface eth0 inet manual
   pre-up   ifconfig eth0 up
   pre-down ifconfig eth0 down


auto  br0
iface br0 inet static
  address   5.5.5.1
  broadcast broadcast.ip
  netmask   netmask.ip
  gateway   gateway.ip
  bridge_ports eth0
  bridge_fd 0
  bridge_maxwait 0


auto  br1
iface br1 inet static
  address   10.10.10.100
  netmask   255.255.255.0
  bridge_fd 0
  bridge_maxwait 0
  pre-up brctl addbr br1
  up iptables -t nat -F POSTROUTING

  # Exclude boxes with static IPs from Natting
  up iptables -A PREROUTING -t nat -i br0 -p tcp -s 5.5.5.2 -j ACCEPT


  # Enable Forwarding for NATed boxes
  up iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o br0 -j MASQUERADE

  # example PORT FORWARDINGS FOR Mailserver
  up iptables -A PREROUTING -t nat -i br0 -p tcp --dport 25 -j DNAT --to 10.10.10.1:25
  up iptables -A PREROUTING -t nat -i br0 -p tcp --dport 465 -j DNAT --to 10.10.10.1:465
  up iptables -A PREROUTING -t nat -i br0 -p tcp --dport 587 -j DNAT --to 10.10.10.1:587

  # example PORT FORWARDINGS FOR Webserver
  up iptables -A PREROUTING -t nat -i br0 -p tcp --dport 80 -j DNAT --to 10.10.10.2:80
  up iptables -A PREROUTING -t nat -i br0 -p tcp --dport 443 -j DNAT --to 10.10.10.2:443

  post-down iptables -F
  post-down iptables -t nat -F
  post-down brctl delbr br1



#IP forwarding must be enabled in the kernel as well (don't forget reboot)
#/etc/sysctl.conf
net.ipv4.ip_forward=1

CONTAINER A Setup (static virtual public IP):

lxc.utsname = containershostname
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0

# This is the MAC for the public IP i got from my provider
# container gets IP by providers DHCP
lxc.network.hwaddr = 00:11:22:33:44:55

CONTAINER B Setup (static NATed private IP):

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br1
lxc.network.ipv4= 10.10.10.1
lxc.network.ipv4.gateway = 10.10.10.100
18Nov/140

Schriftfarbe von Objekten auf dem Cinnamon Desktop ändern

Heute mal etwas kosmetisches, das mich ewig genervt hat: Je nach GTK3-Theme ändert sich die Schriftfarbe von Ordnern und Dateien auf dem Cinnamon-Desktop, so dass die Schrift bei manchen Wallpapers kaum noch lesbar ist.

Man kann das Ganze zum Glück global ändern, habe nur ewig gebraucht um herauszufinden wo.
Hier ein Beispiel für weisse Font:

# Datei anlegen: $HOME/.config/gtk-3.0/gtk.css

.nemo-desktop.nemo-canvas-item {
color: #FFFFFF;
background-color: #5E80A0;
text-shadow: 1px 1px @desktop_item_text_shadow;
}
23Jun/140

VAULT – A small script to create and mount encfs encrypted directories on the fly

This small script will allow you to create, mount and unmount encfs directories on the fly.
As the need for encryption seems to rise all the time, usable solutions always come in handy.

You can create a safe storage for sensible data quickly and easily with this script.

All you need to do to is to install encfs with your distrubutions package manager and adjust the tiny CONFIG section to your needs.
The script will take care of the rest (hopefully).

Comments welcome.

#!/bin/bash
#
# VAULT
# DR 20140624
# http://www.daniel-ritter.de/blog/vault-create-and-mount-encfs-encrypted-directories-on-the-fly
# 
# 
# CREATE AND MOUNT ENCFS ENCRYPTED DIRECTORIES ON THE FLY
#
# ENCFS NEEDS TO BE INSTALLED (apt-get install encfs for Debian/Ubuntu)
# ADJUST CONFIG SECTION TO YOUR NEEDS
#
# NO GUARANTEES, KNOW WHAT YOU ARE DOING
# THIS IS LICENSED WITH GPL
# http://www.gnu.org/licenses/gpl.txt



# CONFIG

VAULTBASEDIR=/home/myusername
FILEMANAGER=nautilus

# END OF CONFIG


clear
echo "VAULT"
echo


# INITIAL SETUP creates directories and sets up encryption
if [ ! -d "$VAULTBASEDIR/.vault_dec" ];then
echo "NO VAULT FOUND. CREATING..."
echo
echo
encfs $VAULTBASEDIR/.vault $VAULTBASEDIR/.vault_dec
touch $VAULTBASEDIR/.vault_dec/mounted
fusermount -u $VAULTBASEDIR/.vault_dec
echo
echo
echo "VAULT CREATED. RUN vault TO LOCK AND UNLOCK IT."
exit
fi



# VAULT is unlocked, lock it
if [[ -e $VAULTBASEDIR/.vault_dec/mounted ]];then
echo "Locking VAULT"
echo
fusermount -u $VAULTBASEDIR/.vault_dec
ls -la $VAULTBASEDIR/.vault_dec
echo
echo
echo "LOCKED"


# VAULT IS LOCKED, unlock it and open filemanager
else
echo "UNLOCKING VAULT"
encfs $VAULTBASEDIR/.vault $VAULTBASEDIR/.vault_dec
$FILEMANAGER $VAULTBASEDIR/.vault_dec
fi

veröffentlicht unter: Linux, Ubuntu keine Kommentare
11Nov/130

Pound Reverse Proxy für HTTP und HTTPS – Quick and dirty Howto auf Debian Squeeze

Pound ist ein Loadbalancer und Reverse Proxy für HTTP und HTTPS. Hier ein Quick and Dirty Setup für das HTTPS-Proxying eines HTTP-Servers. Praktisch um zum Beispiel einem Webdienst, der kein HTTPS unterstützt, trotzdem eine sichere Verbindung zu spendieren.

Pound installieren

apt-get install pound

SSL-Key und Zertifikat generieren
Pound erwartet Zertifikat und Key in einer! Datei.

cd /etc/ssl
mkdir pound
cd pound
openssl req -x509 -newkey rsa:1024 -keyout pound.pem -out pound.pem -days 9999999 -nodes

Pound konfigurieren
(Alle eingehenden Verbindungen an https://192.168.1.2:9999 werden weitergeleitet an 127.0.0.1:8000)

#/etc/pound/pound.cfg

######################################################################
## global options:

User            "www-data"
Group           "www-data"
#RootJail       "/chroot/pound"

## Logging: (goes to syslog by default)
##      0       no logging
##      1       normal
##      2       extended
##      3       Apache-style (common log format)
LogLevel        1

## check backend every X secs:
Alive           30

## use hardware-accelleration card supported by openssl(1):
#SSLEngine      ""

# poundctl control socket
Control "/var/run/pound/poundctl.socket"


######################################################################
## listen, redirect and ... to:

## redirect all requests on port 8080 ("ListenHTTP") to the local webserver (see "Service" below):
ListenHTTPS
        Address 192.168.1.2
        Port    9999
        Cert    "/etc/ssl/pound/pound.pem"

        ## allow PUT and DELETE also (by default only GET, POST and HEAD)?:
        xHTTP           1

        Service
                BackEnd
                        Address 127.0.0.1
                        Port    8000
                End
        End
End

In Debian den Daemon enablen

#/etc/default/pound
startup=1

Pound starten

/etc/init.d/pound start
6Nov/130

Die Festplatte der PS3 auf eine größere Festplatte klonen mit Linux

2013-11-06-20-51-04-820

Die Festplatte meiner Uralt-PS3 wurde nun endlich mit ihren 80GB zu klein. Zum Glück hatte ich noch eine 500GB-Platte herumfliegen und habe diese meiner Konsole spendiert.

Die ganze Sache war leider ziemlich zeitaufwändig. Hätte ich eine weitere Platte für ein Backup mit dem PS3-Systemprogramm gehabt, hätte ich mir viel Kopiererei sparen können. Aber es ging auch so...

Für diese etwas komplizierte Methode braucht man:

  • Die alte Platte aus der PS3
  • Eine neue Platte
  • Einen PC mit genug Platz auf der Platte um die alte Platte komplett aufzunehmen
  • Einen SATA-USB-Adapter

AUSBAU: Zunächst baut man die Platte aus der PS3 aus. Das geht ziemlich einfach. An der linken Seite befindet sich eine Plastikabdeckung, die man aufwippen kann. Danach entfernt man die blaue Schraube und kann den Schlitten mit der Platte einfach aus der Konsole herausziehen.

ORIGINALPLATTE AUSLESEN: Nun benötigt man einen USB-SATA Adapter, um die Platte an einen Rechner anschließen zu können. Auf dem Rechner muss genug Platz sein, um die komplette Platte aufzunehmen. Das Auslesen selbst geht ganz einfach.

Zunächst /var/log/syslog beim Anstecken der Platte per USB mitlesen um den Devicenamen zu erhalten..


> tail -f /var/log/syslog
...
Nov  6 20:38:27 think kernel: [ 3035.910418] sd 7:0:0:0: [sdb] 156301488 512-byte logical blocks: (80.0 GB/74.5 GiB)
Nov  6 20:38:27 think kernel: [ 3035.913066] sd 7:0:0:0: [sdb] Write Protect is off
Nov  6 20:38:27 think kernel: [ 3035.913075] sd 7:0:0:0: [sdb] Mode Sense: 28 00 00 00
Nov  6 20:38:27 think kernel: [ 3035.914499] sd 7:0:0:0: [sdb] No Caching mode page found
Nov  6 20:38:27 think kernel: [ 3035.914507] sd 7:0:0:0: [sdb] Assuming drive cache: write through
Nov  6 20:38:27 think kernel: [ 3035.919639] sd 7:0:0:0: [sdb] No Caching mode page found
Nov  6 20:38:27 think kernel: [ 3035.919646] sd 7:0:0:0: [sdb] Assuming drive cache: write through
Nov  6 20:38:27 think kernel: [ 3036.013996]  sdb: unknown partition table
Nov  6 20:38:27 think kernel: [ 3036.019555] sd 7:0:0:0: [sdb] No Caching mode page found
Nov  6 20:38:27 think kernel: [ 3036.019562] sd 7:0:0:0: [sdb] Assuming drive cache: write through
Nov  6 20:38:27 think kernel: [ 3036.019567] sd 7:0:0:0: [sdb] Attached SCSI disk

Prima. Die PS3-Platte ist nun unter /dev/sdb erreichbar.

Nun kann die komplette Platte in eine einzelne Datei ausgelesen werden.

> sudo su
> dd if=/dev/sdb of=/tmp/ps3.disk bs=50000

Nun muss man warten, bis die Kopie fertig ist. Man kann sich allerdings in einem neuen Terminalfenster ansehen, wie weit der Kopiervorgang fortgeschritten ist:

> watch "ls -hla /tmp | grep disk"
-rw-r--r--  1 root root  43G Nov  6 21:13 ps3.disk

Der ganze Vorgang hat bei mir ziemlich genau eine Stunde gedauert.

N1600527+1 Datensätze ein
1600527+1 Datensätze aus
80026361856 Bytes (80 GB) kopiert, 3600,04 s, 22,2 MB/s

KOPIE AUF DIE NEUERE, GRÖßERE PLATTE ZURÜCKSPIELEN: Nun tauscht man die Platten am SATA-USB-Adapter aus und schließt die neue, größere Platte an. Das Zurückspielen der Daten dauert dann noch einmal genausolang und kann wieder mit "dd" erledigt werden.

> dd if=/tmp/ps3.disk of=/dev/sdb bs=50000

DIE NEUE PLATTE EINBAUEN: Nun hat man eine Kopie der Originalplatte auf der neuen Platte. Diese wird jetzt in die PS3 eingebaut. Wenn die PS3 hochfährt und noch alle Daten vorhanden sind und Spiele gestartet werden können, ist alles glatt gelaufen. Nun hat man zwar eine Kopie der alten Platte auf der Neuen, aber die alte Partitionierung wurde mitkopiert. Die neue Platte hat also auch nur den freien Platz der alten Platte verfügbar. Ich habe keine Möglichkeit gefunden, die Partition der Platte zu vergrößern, SONY nutzt leider kein Standard-Dateisystem. Deshalb sind die nächsten Schritte auch noch notwendig.

DIE ALTE PLATTE ZUM BACKUP DER SPIELDATEN DER PS3 NUTZEN: Die alte Platte wird nun wieder an den SATA-USB-Adapter gesteckt und mit FAT32 formatiert.

>  mkfs.vfat -I -F32 /dev/sdb 

Die formatierte alte Platte kann jetzt per USB an die PS3 angeschlossen werden. Mit ihr führt man nun über das Playstation-Menü eine Sicherung der Spieldateien durch.

Vor dem Backup sollte man seine Tropähen noch einmal synchronisieren. Sie werden mit dem lokalen Backup NICHT mitgesichert.

#PS3 Menü
 [PSN] > [Trophäen-Sammlung] > Dreieck > Trophäen synchronisieren.

Jetzt kann man endlich die Daten auf die alte angeschlossene Platte sichern:

#PS3 Menü
 [Einstellungen] > [System-Einstellungen] > [Datensicherungsprogramm] > [Sichern]

DIE NEUE (EINGEBAUTE) PLATTE LÖSCHEN UND DANACH DIE SICHERUNG VON DER ALTEN PLATTE ZURÜCKSPIELEN:

Neue (eingebaute) Platte löschen:

#PS3 Menü
 [Einstellungen] > [System-Einstellungen] > [Formatierungs-Dienstprogramm] > [Systemspeicher formatieren]

Jetzt steht endlich der volle Speicherplatz der neuen Platte zur Verfügung.

Nun muss nur noch das Backup von der alten Platte zurückgespielt werden:

#PS3 Menü
 [Einstellungen] > [System-Einstellungen] > [Datensicherungsprogramm] > [Wiederherstellen]

Voila, ich habe alle meine Daten komplett behalten, aber habe jetzt 420GIG mehr Platz und die Platte ist um einiges schneller als die alte. Sehr schön.

Anmerkungen:
Leichter wäre alles gegangen mit einer weiteren Platte, die ich leider nicht zur Verfügung hatte:
PS3-Platte direkt mit der PS3 auf die weitere Platte sichern -> Neue grosse Platte einbauen -> Alles von der weiteren Platte zurücksichern.

Wenn man einen PC zur Verfügung hat (ich hatte nur ein Notebook) sollte man die Kopiererei auch nicht über USB machen sondern die Platten direkt an die SATA-Ports des Boards hängen. Viel schneller.