Greg Erskine wrote: 
> hi chill,
> 
> This might be worth a try. It is based on how we used to generate pCP
> images a few years ago. The image only takes a few seconds to generate.
> 
> My first attempt generated from this image, resulted in a SD card
> appears to be working properly. :D
> 
> > 
Code:
--------------------
  >   > $ fdisk -l /dev/mmcblk0
  > 
  > Disk /dev/mmcblk0: 3724 MB, 3904897024 bytes, 7626752 sectors
  > 119168 cylinders, 4 heads, 16 sectors/track
  > Units: sectors of 1 * 512 = 512 bytes
  > 
  > Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  
Size Id Type
  > /dev/mmcblk0p1    128,0,1     127,3,16          8192      73727      65536 
32.0M  c Win95 FAT32 (LBA)
  > /dev/mmcblk0p2    1023,3,16   1023,3,16        73728     483327     409600  
200M 83 Linux
  > ===== 
  > 232
  > $ dd if=/dev/mmcblk0 of=/tmp/backup.img bs=1M count=232
  > 
--------------------
> > 
> 
> I actually had 3 partitions on this SD card, and obviously partition 3
> was not copied.
> 
> regards
> Greg

Thanks Greg - that's the approach I went for yesterday.  I scripted it
so that it would work even after resizing partition 2.  Here's my
BackupSD.sh.  It extracts the blocksize from the original SD card, so
that I can add 1 block to the EndLBA of the second partition:

Code:
--------------------
    imagefile=$1
  bs=$(fdisk -l | grep -A 3 mmcblk0: | grep Units: | awk -F= {'print $2'} | awk 
{'print $1'})
  echo "blocksize="$bs
  count=$(fdisk -l | grep mmcblk0p2 | awk {'print $5+1'})
  echo "count="$count
  dd if=/dev/mmcblk0 bs=$bs count=$count of=$imagefile
  
--------------------


My SD card has grown to 1GB, and this takes just under a minute to
create.  I do a 'pcp bu' just before calling this, to make sure any
changes I've made are included in the image.

I'll need to investigate how to rsync it properly though.  I ran the
script for the first time overnight last night (with rsync options
-rtvhiO), and it evidently only updated the target file's timetag.  I
think this is because the image will always be the same size, so rsync
believes that the source and target files are identical apart from the
timetags.  I'll need to force it to update unless the contents are
identical - presumably using the slower '-c' 'skip based on checksum'
option.


------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=110496

_______________________________________________
ripping mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/ripping

Reply via email to