Extracting images from raw partition

From ElphelWiki
Revision as of 15:05, 10 August 2018 by Oleg (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

As it was mentioned in camogmgui, camogm can save images to a raw partition or disk in fast recording mode and you need to do one additional step to extract these images from such a partition. This short note describes how to get images from raw partition.

1. Download these scripts to your PC.

2. Connect camera to eSATA port, power it on and wait until it has loaded.

3. Copy ssh key to camera. This step can be skipped if it was done before.

$ ssh-copy-id root@192.168.0.9

4. Run int_ssd_download.py script to dump camera's raw partition to PC.

$ ./int_ssd_download.py -c root@192.168.0.9 -n 1 -bs 100 -bc 1 .
root@192.168.0.9: connection ok
root@192.168.0.9: raw partition name: Crucial_CT250MX200SSD6_1531103B6ABA-part2
umounting /dev/sda1
root@192.168.0.9: Enabled connection: internal SSD <-> PC
Connect camera (eSATA) to PC (eSATA/SATA). Press Enter to continue...
[sudo] password for mk: 
Getting raw partition data from /dev/sdb2
1+0 records in
1+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.501566 s, 209 MB/s
Waiting for disks to show up:
[]
root@192.168.0.9: Enabled connection: internal SSD <-> Camera
Done

Here, the -c parameter specifies which camera to use and script controls this camera to switch internal disk to eSATA and find raw partition. The -n, -bs and -bc parameters specify the number of chunks to download, block size in MB and the number of blocks in each chunk respectively. The script will create a subdirectory, which name is made of disk manufacturer, model and partition number, and download disk dump into this subdirectory.

$ ls -l 
total 84
drwxrwxr-x 2 mk mk  4096 Jan 11 10:53 Crucial_CT250MX200SSD6_1531103B6ABA-part2
-rw-rw-r-- 1 mk mk  4308 Jan  9 18:38 extract_images.php
-rwxrwxr-x 1 mk mk  3177 Jan  9 18:38 ext_ssd_download.py
-rwxrwxr-x 1 mk mk  4726 Jan 10 17:12 int_ssd_download.py
-rw-rw-r-- 1 mk mk 35141 Jan  9 18:38 LICENSE
-rw-rw-r-- 1 mk mk   620 Jan  9 18:38 README.md
-rw-rw-r-- 1 mk mk  6110 Jan  9 18:38 x393.py
-rw-rw-r-- 1 mk mk 10016 Jan  9 18:39 x393.pyc

5. Use extract_images.php sctipt to extract images from disk dump.

$ ./extract_images.php Crucial_CT250MX200SSD6_1531103B6ABA-part2
<pre>
Splitting Crucial_CT250MX200SSD6_1531103B6ABA-part2/file_0.img into jp4s

All images will be placed to result subdirectory.

$ ls -l Crucial_CT250MX200SSD6_1531103B6ABA-part2/
total 102404
-rw-r--r-- 1 root root 104857600 Jan 11 10:53 file_0.img
drwxrwxr-x 2 mk   mk        4096 Jan 11 12:22 result