Jump to content

move armbian from one SD to another


Guest thom_arm

Recommended Posts

Guest thom_arm

Hi,

 

Thanks to this great project I sucessfully installed armbian on my cubietruck and moved the installation (Vanilla Jessie) to a hard disk. Now I want to move the remaining SD parts (obviously only /boot) to another (much smaller) SD card. Creating a partition and copying the stuff 1:1 does not work (leaves the new SD card unbootable.

 

How to achieve the above?

 

Thanks

Thom

Link to comment
Share on other sites

Guest thom_arm

Hi,

 

thanks so far. Which .deb to extract it from for the most recent vanilla Jessie? I suppose that I need to write it using:

dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0p1 bs=1024 seek=8

however there are several version available in http://apt.armbian.com/pool/main/l/linux-u-boot-cubieboard2/

 

[Edit]: I also found /usr/lib/nand-sata-install/a20/bootloader/linux/u-boot.bin in my installation - isn´t this also a valid bootloader for SD? However it seems much smaller than the ones from the above URL...

 

Thanks

Thom

Link to comment
Share on other sites

thanks so far. Which .deb to extract it from for the most recent vanilla Jessie? I suppose that I need to write it using:

dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0p1 bs=1024 seek=8

however there are several version available in http://apt.armbian.c...ot-cubieboard2/

 

Just grab latest (4.81) and you will be fine. There are at most three different versions anyway.

 

If you are on the board, booted from SD, just install the deb package and the boot loader is auto written, if you are not than you need to extract the file and DD-it to the SD card (mmcblk0) and not to the partition (mmcblk0p1)

 

The u-boot loader which you found is just for booting from NAND.

Link to comment
Share on other sites

Guest thom_arm

Hi,

 

thanks for the answer - however it does not work for some reasons. what I did:

 

- partitioned the new SD card in another machine

- created an ext4 fs on it

- dd´ed the bootloader to it

- connected the new SD card via USB to the cubietruck

- rsync´ed /boot from the current boot SD to the new SD card.

- exchanged the SD card and bootet from the new one

 

as a result the board does not come up. Unfortunately it is totally headless, no serial line or moitor attached :( Only indicator is a 433MHz USB transmitter connected to the board where the LED usually flashes periodically. After powering the device on it starts flashing as normal but then stops doing that after about 15 seconds.

 

Am I missing something?

 

Thanks

Thom

Link to comment
Share on other sites

Doing this blindly is a recipe that it won't work :huh: I don't do such way even I have done it so many times.

I think at least you forgot to rsync /lib/modules and /lib/firmware from boot image.

Link to comment
Share on other sites

Guest thom_arm

Hi,

 

Doing this blindly is a recipe that it won't work :huh: I don't do such way even I have done it so many times.

I think at least you forgot to rsync /lib/modules and /lib/firmware from boot image.

 

I thought that only /boot and a properly written bootloader is needed on SD card when having everything else moved to a SATA disk?

 

Thanks

Thom

Link to comment
Share on other sites

In theory yes :P But we have some problem here which we need to guess out if we don't have serial console.

 

Check if your boot.cmd is pointing to /dev/sda1 or wherever your system is. Remember to recompile boot.cmd to boot.scr before booting if you change something.

Link to comment
Share on other sites

Basically you need to write a boot loader to new SD card. Extract it from .deb file and write with DD ...

Igor, isn't this uncesseraly complicated as dd will take whatever boot loader is on the old sd-card.

You can (at least in the old days when I did it last time) with these steps.

 

First some notes:

1. Have a running Linux/Unix/Mac system other than the system on the original SD card. Any Linux Live CD will work as they all have dd.

2.  Your new SD card (on /dev/sda) must be identical or larger than your old SD card (on /dev/sdb).

3. You must unmount your SD cards during these steps (or mount them as read-only). THIS IS IMPORTANT.

4. I use sdX as a generic name here, your devices will probably be named differant. Use lsblk to find out the names.

 

Run the following codes.

# Copy old SD to you computer as a image. SD card must be unmounted before this code.
dd if=/dev/sdb of=/path/to/image bs=512

# Copy image to new SD card, 
​# Note sda is just a generic name here to indicate your new card to differentiate it from your old card. 
​# It will actually be the same block device in both lines of code as you are using the same card reader.
dd if=/path/to/image of=/dev/sda bs=512

If you have a computer with 2 SD card readers then you can combine both line to a single line of code as

dd if=/dev/sdb of=/dev/sda bs=512

If you want to copy the boot-loader of a device then use the following code

 â€‹# Copy bootloader (Master boot record, MBR, https://en.wikipedia.org/wiki/Master_boot_record)
dd if=/dev/sdb of=/path/to/mbr bs=512 count=1

Further notes:

* Note that I am using the block device /dev/sda and not the partition /dev/sda1 on that device.  

* If your new card is larger than your old card then you migth need to resize your partitions afterwords. You can use parted/gparted or whatever is on your Linux system. I'm sure armbian have some tools for that. Maybe Igor could help on this.

* If you new SD card is smaller than you can still perform these task but with more steps. Let me know if this is the case.

* Boot loader and information about your partitions used to be within the first 512 bytes of a device. I'm not sure how u-boot works so you may need to verify the last code.

Link to comment
Share on other sites

Igor, isn't this uncesseraly complicated as dd will take whatever boot loader is on the old sd-card.

 

For SD to SD yes. Your guide is perfectly correct.

 

Things gets messy when we start to combine SD, NAND and SATA and if you want to transfer only boot part of the SD image to another and transfer rootfs to SATA ... or if you want to write u-boot which is designed for NAND to blank SD card  ;)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines