clone to hard disk by running diet pi and root is hard disk

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
hatahata
Posts: 26
Joined: Thu Jul 07, 2016 3:42 am

clone to hard disk by running diet pi and root is hard disk

Post by hatahata »

hi all . i use dietpi on odroid-c2 by cloning sd card's root to hard disk .

i do this cloning on running diet pi .

now 2.5 inch hard disk drive is root .
Image


1) rewrite /boot/boot.init

setenv bootargs "root=UUID=83b7a780-6e17-4852-a847-459cef9db955 rootwait ro ${condev} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop disablehpd=${hpd}"

83b7a780-6e17-4852-a847-459cef9db955 is obtained by blkid /dev/sda1

1) may be unnesesary , becase /DietPi/boot.ini overwrite /boot/boot.init


2) rewite /DietPi/boot.ini equally 1)

3) do next script
mkdir -p /ma1
umount /ma1
mount /dev/sda1 /ma1
df

read X
echo $X

for x in dev mnt proc run sys tmp
do
rm -rf /ma1/$x
mkdir -p /ma1/$x
done

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

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

for x in dev mnt proc run sys tmp
do
rm -rf /ma1/$x
mkdir -p /ma1/$x
done




4) rewrite /ma1/etc/fstab
/dev/mmcblk0p2 / ext4 defaults,noatime,discard
->
/dev/sda1 / ext4 defaults,noatime,discard 0 1


reboot
then

df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 51475068 1769996 47067248 4% /
udev 10240 0 10240 0% /dev
tmpfs 351892 5832 346060 2% /run
tmpfs 879724 0 879724 0% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 879724 0 879724 0% /sys/fs/cgroup
tmpfs 10240 1168 9072 12% /DietPi
tmpfs 20480 40 20440 1% /var/log
tmpfs 879724 4 879720 1% /tmp
/dev/mmcblk0p1 130798 46746 84052 36% /boot

i get big hard disk drive if sda1 is 250GB ore more .
now i run dietpi as big server , for example apache .
:D

------------
regards

perhaps this method may be ok on cloning sd card .
Last edited by hatahata on Sun Jul 17, 2016 9:58 pm, edited 10 times in total.
hatahata
Posts: 26
Joined: Thu Jul 07, 2016 3:42 am

Re: clone to hard disk by running diet pi and root is hard d

Post by hatahata »

it is sad that hard disk will be destroyed .

so i clone /dev/sda (USB hard disk) to /dev/sdb (USB hard disk)

boot by /dev/sda

1) imprtant
rewrite /DietPi/boot.ini by doing ' blkid /dev/sdb1'


2) shell sctipt

mkdir -p /mb1
umount /mb1
mount /dev/sdb1 /mb1
df
read X
echo $X
for x in dev mnt proc run sys tmp
do
rm -rf /mb1/$x
mkdir -p /mb1/$x
done
cd /mb1
mkdir -p DietPi bin boot etc home lib opt root sbin srv usr var
for x in bin boot etc home lib opt root sbin srv usr var
do
rsync -avHx --delete /$x/ /mb1/$x/
done
for x in dev mnt proc run sys tmp
do
rm -rf /mb1/$x
mkdir -p /mb1/$x
done


then halt , remove only /dev/sda , and boot
df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 113916480 1791256 106331948 2% /

about 120GB is available .
we donot need rental server if we have dietpi which runs on hard disk ( sd card is only starter ) :D
hatahata
Posts: 26
Joined: Thu Jul 07, 2016 3:42 am

Re: clone to hard disk by running diet pi and root is hard d

Post by hatahata »

64bit can use over 4GB memory .
odroid-c2 has only 2GB , so i realized it by SWAP .

now

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 111852224 1666388 104481036 2% / -> 120GB
udev 10240 0 10240 0% /dev
tmpfs 351892 10256 341636 3% /run
tmpfs 879724 0 879724 0% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 879724 0 879724 0% /sys/fs/cgroup
tmpfs 10240 1168 9072 12% /DietPi
tmpfs 20480 40 20440 1% /var/log
tmpfs 879724 24 879700 1% /tmp
/dev/mmcblk0p1 130798 46754 84044 36% /boot

top - 20:14:18 up 4 min, 2 users, load average: 0.22, 0.17, 0.08
Tasks: 124 total, 3 running, 121 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.1 sy, 0.0 ni, 98.1 id, 1.6 wa, 0.0 hi, 0.2 si, 0.0 st
KiB Mem: 1759448 total, 287624 used, 1471824 free, 8604 buffers
KiB Swap: 6291452 total, 0 used, 6291452 free. 103552 cached Mem --->6GB


/etc/rc.local
/DietPi/dietpi/dietpi-services start
/DietPi/dietpi/dietpi-banner 0
echo " Default Login:\n Username = root\n Password = dietpi\n"
swapon /dev/sda3
exit 0
Post Reply