Trouble

reduce sd partition size and copy to smaller sd

2 938
Hi (sorry for my poor english)
I have a banana pi pro with a sata HD connected and a sd for booting.

I have installed bananian 15-08 to a sd card and after copied files from the sd to the sata, modified the boot.cmd for using the sata hard drive. Everything is good and works fine

  1. #--------------------------------------------------------------------------------------------------------------------------------
  2. # Boot loader script to boot with different boot methods for old and new kernel
  3. # Credits: https://github.com/igorpecovnik - Thank you for this great script!
  4. #--------------------------------------------------------------------------------------------------------------------------------
  5. if load mmc 0:1 0x00000000 uImage-next
  6. then
  7. # mainline kernel >= 4.x
  8. #--------------------------------------------------------------------------------------------------------------------------------
  9. setenv bootargs console=ttyS0,115200 console=tty0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
  10. load mmc 0:1 0x49000000 dtb/${fdtfile}
  11. load mmc 0:1 0x46000000 uImage-next
  12. bootm 0x46000000 - 0x49000000
  13. #--------------------------------------------------------------------------------------------------------------------------------
  14. else
  15. # sunxi 3.4.x
  16. #--------------------------------------------------------------------------------------------------------------------------------
  17. setenv bootargs console=ttyS0,115200 console=tty0 console=tty1 sunxi_g2d_mem_reserve=0 sunxi_ve_mem_reserve=0 hdmi.audio=EDID:0 disp.screen0_output_mode=EDID:1680x1050p60 root=/dev/sda1 rootfstype=ext4 elevator=deadline rootwait
  18. setenv bootm_boot_mode sec
  19. load mmc 0:1 0x43000000 script.bin
  20. load mmc 0:1 0x48000000 uImage
  21. bootm 0x48000000
  22. #---------------------------------------------------------------------------------------------------------------------------------
  23. fi
Copy the Code

Actually the size of my sd card is 16G, and it's just used for the boot (root=/dev/mmcbl0p2).

I want to replace this card for a smaller one.

I have put my 16g card on my computer (debian) and did:
  
  1. fdisk -l /dev/my16gsd  (sdXx for me or mmcblXpx)
Copy the Code
Disk /dev/my16gsd: 14,9 GiB, 15980298240 bytes, 31211520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device           Boot  Start End Sectors Size Id Type
./my16gsd1           2048   43007    40960    20M 83 Linux
./my16gsd2          43008 3710936  3667929   1,8G 83 Linux

copy the sd in a image
  1. dd if=dev/my16gsd of=./clone.img
Copy the Code
  1. fdisk -l ./clone.img  #same as /dev/my16gsd
Copy the Code
Disk ./clone.img: 14,9 GiB, 15980298240 bytes, 31211520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
./clone.img1 2048 43007 40960 20M 83 Linux
./clone.img2 43008 3710936 3667929 1,8G 83 Linux

So i have two partitions:
clone.img1 for the boot = 20M
clone.img2 for the system = 1.8G
The last sector of my second partition is 3710936.
(3710936 *512) /1024 /1024 /1024 = 1.769 mo

My second card:

Disk /dev/my2gsd : 1,9 GiB, 1977614336 bytes, 3862528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

My2gsd have 1977614336 bytes.
1977614336 /1024 /1024 /1024 = 1.841mo

3710936 < 1977614336
1.769 mo < 1.841mo

for me there is enough place on my small card for the two partitions.

so i wrote  this:
  1. dd if=./clone.img of=/dev/my2gsd bs=1M && sync
Copy the Code
now in my small sd it look likes the bigger one.
After this i putted the small microsd on my banana pro but nothing appeared

Do i have something wrong? is my sd is to small?
Is there another way to boot from my sata Hd with a small sd?

I have also begun to try an other way like formating my two partitions manually. Copy manually the boot partition from the bigSd, putted on the firt partition to the smallSd and on the second put the /boot directory from the big sd card but it more complicated and for me there is enough place on the small sd.

So everybody when you use a sata hd ou ssd, are you obligated to have sd? (I think yes)
Is it obligated to have a /boot directory on the sd?

In resume What the minimum to have on the sd card for booting to the sata?

Thx for helping

felix

If boot partition is 20 mb then any size above that will be enough,

igorpec  
Edited by igorpec at Mar 07, 2016 06:14
What the minimum to have on the sd card for booting to the sata?

Minimal that exists and tha it's supported. If you are using recent mainline u-boot, you only need to write u-boot to the card and boot sata directly ... but you need to write new / modify a boot script.

You have to log in before you can reply Login | Sign Up

Points Rules