I've been playing around with this - or should I say trying to play.
First, a comment, - I don't think dd should be necessary as the diskSpaceExpander program just uses rsync to copy the files.
Edit to add ... I should explain that my interest in this is because you can't use dd unless you can have access to the two microSD cards at the same time. However if copy works I can copy to a temporary directory and then to the new microSD card
On the First thing,
dd, known as disk duplicator, is a faithful bit-by-bit, block-by-block duplication tool. DD can be used as you are thinking. It has an option to write to a file. (See
dd - man page
rsync is for syncronizing projects across systems. It is not faith as a block-by-block duplication tool.
Second, PROBLEM. which means I can't test my theory.
I bought a second microSD card and the Yun does not seem to be able to see it even though it appears to work perfectly on my Linux PC.
Within the diskSpaceExpander program it just uses ls /mnt/sda1 as a test for whether there is a microSD card and when I try that with ssh it says no such file or directory (or the equivalent). When I plug in my other microSD card it lists the files.
On the second part, Linux has several steps before you can
ls (or see a file system).
- See the storage device
- Detect and mount partitions (not the filesystem)
- Do a filesystem check (journaling filesystem is the exception)
- Mount the file system for general use.
ls /mnt/sda1 is to check if it can see the mount point, not the file system. It test can be misunderstood because you can mount a filesystem, but not have it available for use. This would the test in haltIfSDCardIsNotPresent()
One place to see how this is useful is when they run unmount(). In this routine, they run umount to unmount the storage device (to make sure it is disconnected), then they run rm -rf ; where if on the original storage medium there is a subdirectory named
/mnt/sda?, they -r (recursively) -f (force) deletion of anything there. Thereby assuring they are actually dealing with the new storage medium, and not the original storage medium.
Let me know, if this helps.