Jump to content

tentative proposal; duplicate sd card on running orange pi


hatahata

Recommended Posts

hi all .

 

i try clone  sd card on running orange pi (cone 32GB to 16GB).

original sd is 32GB ,  clone sd is 16GB .

 

1) insert USB sd converter ( 16GB sd is in ).

    this is recognized as sdb  because i alredy attach USB HDD.

 

 

2) i alredy install boot loader into sdb (16GB).  see -> http://forum.armbian.com/index.php/topic/897-backup-restore/

so

 

mkfs.ext4 /dev/sdb1

 

 

3)mount /dev/sdb1 /mb1

and run the next shell script

----------------------------------------

 

cd /mb1
df
pwd
cp  --archive /bin /etc /home /lib /opt /root /run /sbin /srv /tmp /usr /var /selinux /boot /media      ./
mkdir -p boot dev sys mnt proc

 

 

4) then halt , and replace sd card .

    orange pi boot with new 16GB sd card .

 

if this is right ,  backup is easy and time sparing because this is done on running machine . :lol:

 

--------------------------------------------

tuyosi

Link to comment
Share on other sites

What about rsync command which we use for transferring system from SD to USB / NAND / HARD drive?

 

https://github.com/igorpecovnik/lib/blob/master/scripts/nand-sata-install/usr/lib/nand-sata-install/nand-sata-install.sh#L55-L56 

 

.exclude file content example:

/boot/*
/dev/*
/proc/*
/sys/*
/media/*
/mnt/*
/run/*
/tmp/*

Mount destination under /destination and execute:

rsync -avrltD --delete --exclude-from=.exclude / /destination
Link to comment
Share on other sites

thanks  for great advice .

 

i try another orange pi PC running armbian , this is ordinaly armbian which has 32GB micro sd card only .

( i do not stop armbian , make clone sd card on runnning machine  )

 

i insert USB card reader which has 16GB micro sd card .

 

the chart is

 

clone.jpeg

after

 

 

mkfs.ext4  /dev/sda1

mount /dev/sda1 /ma1

 

run the next shell script

shell sctipt is

----------------

df
read X
echo $X
cd /ma1
cp  --archive /bin /etc /home /lib /opt /root  /sbin /srv /usr /var /selinux /boot /SWAP    ./
cd /ma1
mkdir -p  dev proc sys media mnt run tmp

 

i have made  swap file as /SWAP 1 month ago on 32GB sd

 

after halt -p

 

i change 32GB for 16GB , armbian boots .

 

how to install boot loader into 16GB micro sd card  is  http://forum.armbian...backup-restore/  .

--------------------

tuyosi

Link to comment
Share on other sites

i also try the following .

then

orange pi PC also boot armbian .

 

 

clone-rsync.bat
umount /ma1
df
fdisk -l /dev/sda

 

read X
echo $x

mkfs.ext4 /dev/sda1
mount /dev/sda1 /ma1

 

cd /ma1
mkdir -p bin etc home lib opt root sbin srv usr var selinux boot

 

for x in /bin /etc /home /lib /opt /root  /sbin /srv /usr /var /selinux /boot 
do
rsync -avHx  --delete $x/  /ma1/$x/
done
 

cd /ma1
mkdir -p  dev proc sys media mnt run tmp
 

touch /ma1/SWAP
dd if=/dev/zero of=/ma1/SWAP bs=1M count=1024
mkswap /ma1/SWAP

 

-------------------------------

the next ,

 

umount /ma1
df
fdisk -l /dev/sda

 

read X
echo $x

mount /dev/sda1 /ma1
 

cd /ma1
mkdir -p bin etc home lib opt root sbin srv usr var selinux boot

 

for x in /bin /etc /home /lib /opt /root  /sbin /srv /usr /var /selinux /boot 
do
rsync -avHx  --delete $x/  /ma1/$x/
done

 

if this is right ,  fast cloning is done .

-------

regards

Link to comment
Share on other sites

 thanks for good information .

  

-------------------------------------

partclone also use rsync but i have not tried it yet in order to clone sd card's partition  .

anyway it is easy to clone sd card , so we can take the risk of not booting armbian forever  to improve armbian .

 

  nothing ventured, nothing gained

 

---------------

my japanese home page is http://orange-pi-2.blogspot.jp/2016/01/orange-pi-2g.html

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