Skip to content

Using rsync to write to microsd cards #152

@jonesmz

Description

@jonesmz

I'm attempting to use rsync to write an OS image to a microSD card. My objective is to minimize the number of writes that need to happen so that I can avoid using the limited writes that the card supports during it's lifetime.

I'm using this command:

rsync --write-devices /path/to/image.img /dev/mmcblk0

Re-writing the image with the same command, with stats output turned on, shows that the full contents of the file is being written.
I also observed the write buffer for the kernel increasing, e.g. cat /proc/meminfo

rsync --write-devices --info=progress2,stats2 /path/to/image.img /dev/mmcblk0
  8,589,934,592 100%   17.64MB/s    0:07:44 (xfr#1, to-chk=0/1)
rsync: [receiver] ftruncate failed on "/dev/mmcblk0": Invalid argument (22)
  8,589,934,592 100%   17.64MB/s    0:07:44 (xfr#1, to-chk=0/1)

Number of files: 1 (reg: 1)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 1
Total file size: 8,589,934,592 bytes
Total transferred file size: 8,589,934,592 bytes
Literal data: 8,589,934,592 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 8,592,031,828
Total bytes received: 35

sent 8,592,031,828 bytes  received 35 bytes  18,457,640.95 bytes/sec
total size is 8,589,934,592  speedup is 1.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1330) [sender=3.2.3]

What I expected to see happen is that rsync would read the data off of the card, and determine that no additional data need be written.

Am I using it wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions