Clone Yun OS at Linux Box by dd Command

Clone Yun OS at Linux Box by dd Command (experimental)

Plug Micro SD card with reader into Linux box

fdisk -l
...
Disk /dev/sdd: 16.6 GB, 16574840832 bytes
...

Back it to file:

dd if=/dev/sdd of=/root/yun-sd-card.bin

Linux dd Command Show Progress Copy Bar With Status:

http://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/

Monitor Progress of Data Sent Via a Pipe:

http://www.cyberciti.biz/open-source/command-line-hacks/pv-command-examples/

Install pv:

apt-get install pv

Back up it to file:

pv -tpreb /dev/sdd | dd of=/root/yun-sd-card.bin bs=4096 conv=notrunc,noerror
15.4GB 0:15:03 [17.5MB/s] [==================================>] 100%
4046592+0 records in
4046592+0 records out
16574840832 bytes (17 GB) copied, 903.16 s, 18.4 MB/s

Restore from backup file to new Micro SD card:

pv -tpreb  /root/yun-sd-card.bin | dd of=/dev/sdd  bs=4096 conv=notrunc,noerror

sonnyyu: Clone Yun OS at Linux Box by dd Command (experimental)

Is the intention to make a second microSD card that is the same as a working microSD card without going through the process of extending Yun disk space?

If so, is it necessary to use dd rather than just copying the files ? Assuming of course that the appropriate partitions are created with GParted.

...R

Robin2: Is the intention to make a second microSD card that is the same as a working microSD card without going through the process of extending Yun disk space? ...

Yes, plus backup and restore. even duplicate system.

Robin2: ... If so, is it necessary to use dd rather than just copying the files ? Assuming of course that the appropriate partitions are created with GParted. ...

dd use bit by bit copy, a way safe to guarantee identical same copy.

sonnyyu: dd use bit by bit copy, a way safe to guarantee identical same copy.

I am assuming from this that dd is just convenient and not essential.

...R

for my understanding, It is for both. for both MBR and GPT, bit by bit copy is a save way to go.

sonnyyu:
for my understanding, It is for both. for both MBR and GPT, bit by bit copy is a save way to go.

That was what I was wondering about. But as the Yun does not boot from the microSD card I was not sure.

…R

I zero out MBR at SD, nothing is working.

dd if=/dev/zero of=/dev/sda bs=512 count=1

no problem going to restore from backup file.

sonnyyu: I zero out MBR at SD, nothing is working.

dd if=/dev/zero of=/dev/sda bs=512 count=1

no problem going to restore from backup file.

Sorry. I don't understand.

...R

I test MBR with Micro SD, if erase it whole system crashed.

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

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.

I have messed around with formatting the new microSD card using Gparted, but it is now all (4GB) partitioned as Fat32. I also put a single text file on it.

I don't know enough about the possible problems to think of any debug steps I could take, so I would appreciate any suggestions.

...R

Robin2: 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

@Robin2, 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 of)

dd - man page http://linux.die.net/man/1/dd

rsync is for syncronizing projects across systems. It is not faith as a block-by-block duplication tool.

Robin2: 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.

::::SNIP::::

On the second part, Linux has several steps before you can ls (or see a file system).

  1. See the storage device
  2. Detect and mount partitions (not the filesystem)
  3. Do a filesystem check (journaling filesystem is the exception)
  4. Mount the file system for general use.

The 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. Jesse

Thanks Jesse.

I do understand the difference between rsync and dd. I was just pointing out that the diskExpnder program uses rsync.

This would the test in haltIfSDCardIsNotPresent()

That is my point. My microSdCard fails that test, and I don't know why.

...R

I've been doing a little more Googling and I found this Post

The working microSD card that I have is class 10 and the one that does not work is class 4.

Is it possible that the Yun does not work with class 4 cards?

If so, what is the minimum requirement? and where is it documented?

...R

Micro SD controller IC - AU6350 at Yun:

sonnyyu: AU6350 is obsoleted and replaced by AU6353?

AU6353 Techsheet

Complies with Secure Digital Card (SD) specification up to ver. 3.0(SDXC).

For future reference:

AU6350 Techsheet

Support SD spec up to ver. 2.0 (SDHC).

https://www.sdcard.org/downloads/pls/simplified_specs/part1_410.pdf

Detailed SD specs, Page 5,6.

3.3.2 Card Capacity Classification

Hosts that can access (read and/or write) SD Memory Cards with a capacity greater than 2 GB and up to and including 32 GB, shall also be able to access SD Memory Cards with a capacity of 2 GB or less

3.4 Speed Class

  • Class 2 is more than or equal to 2 MB/sec performance (Default Speed Mode)
  • Class 4 is more than or equal to 4 MB/sec performance (Default Speed Mode)
  • Class 6 is more than or equal to 6 MB/sec performance (Default Speed Mode)
  • Class 10 is more than or equal to 10 MB/sec performance (High Speed Mode)

Yun supports Micro SD spec up to ver. 2.0 (SDHC) as well as Class 2/4/6/10 Card.

sonnyyu: Yun supports Micro SD spec up to ver. 2.0 (SDHC) as well as Class 2/4/6/10 Card.

Thanks very much @sonnyyu.

I'm not sure whether this is reassuring or worrying?

Why does it not recognize my class 4 microSD card ?

...R

Robin2: Why does it not recognize my class 4 microSD card ?

What is the capacity of the card? That's much more important than the speed class.

Be aware that there are a lot of counterfeit SD cards out there, maybe yours is one? They look like regular cards, but are often not what they claim to be. Often times, a card is sold as one capacity, but actually has much less memory. For example, a 32 GB card may have only 4 GB of memory, which is sure to cause problems! Some vendors state this in the fine print, saying the card has been "upgraded" to report more memory than is actually there, hoping that the buyer doesn't realize what this really means. Others are more unscrupulous and will pass their cards off as full capacity brand names when in fact they are not. There are a bunch of utilities out there for various platforms that will perform validation tests on cards. Try a search time like "fake SD card tester."

ShapeShifter: What is the capacity of the card? That's much more important than the speed class.

It is a 4GB card and seems to work fine on this Linux laptop.

I have re-formatted it to Fat32, Ext2 and Ext4 and none of them is recognized. It looks like it not "electrically" detected by the Yun - just as if it was never inserted.

...R

Robin2: It looks like it not "electrically" detected by the Yun - just as if it was never inserted.

But your other card IS detected? If you look at the contacts inside the SD card socket, you can see some contacts on the side that close when a card is inserted. Could there be a mechanical issue with the card that is not closing the contacts?

Visual effects of what ShapeShifter means

|500x358