拿到板子後,做了很多實驗,也安裝不少軟件和設定,其中遇到很多問題,裝了一堆不知名的軟件模組,搞的Linux有點亂。
想了幾個解決方案,那就是用HD切幾個partition,其中2個來做實驗,只留一個乾淨來做使用。而SD卡就專職開機就好,避免開機失敗。
就開始吧~~~~
想了幾個解決方案,那就是用HD切幾個partition,其中2個來做實驗,只留一個乾淨來做使用。而SD卡就專職開機就好,避免開機失敗。
就開始吧~~~~
root@bpro / # fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 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
Disk identifier: 0x00002b91
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-234441647, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-234441647, default 234441647): +32G
Command (m for help): p
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 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
Disk identifier: 0x00002b91
Device Boot Start End Blocks Id System
/dev/sda1 2048 67110911 33554432 83 Linux
連續加入4個partition,目的是未來可以做不同的實驗,避免污染乾淨的Linux環境。
Device Boot Start End Blocks Id System
/dev/sda1 2048 67110911 33554432 83 Linux
/dev/sda2 67110912 134219775 33554432 83 Linux
/dev/sda3 134219776 201328639 33554432 83 Linux
/dev/sda4 201328640 205522943 2097152 83 Linux
Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): 82
Changed system type of partition 4 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 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
Disk identifier: 0x00002b91
Device Boot Start End Blocks Id System
/dev/sda1 2048 67110911 33554432 83 Linux
/dev/sda2 67110912 134219775 33554432 83 Linux
/dev/sda3 134219776 201328639 33554432 83 Linux
/dev/sda4 201328640 205522943 2097152 82 Linux swap / Solaris
root@bpro / # mkfs -t ext4 /dev/sda1
root@bpro / # mkfs -t ext4 /dev/sda2
root@bpro / # mkfs -t ext4 /dev/sda3
Format /dev/sda4為swap
root@bpro / # mkfs -t swap /dev/sda4
準備把SD卡的系統複製到HD的partition
先做sda1:
root@bpro / # mount /dev/sda1 /mnt
root@bpro / # sudo rsync -ahPHAXx --delete --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,swapfile} / /mnt
sda2與sda3如法泡製。
再來,確定sda1/2/3是否都可以boot。
先Mount /dev/mmcblk0p1
修改 uEnv.txt,在內有關於 root=/dev/mmcblk0p2 換成 root=/dev/sda1
最後,reboot試看看是否成功。
root@bpro / # reboot
重新進入系統:
觀察rootfs後,確定是已經使用/dev/sda1。
成功!
root@bpro / # sudo rsync -ahPHAXx --delete --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,swapfile} / /mnt
sda2與sda3如法泡製。
再來,確定sda1/2/3是否都可以boot。
先Mount /dev/mmcblk0p1
root@bpro / # mount /dev/mmcblk0p1 /mnt
root@bpro / # cd /mnt
root@bpro /mnt # nano uEnv.txt
root@bpro / # reboot
重新進入系統:
root@bpro ~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 33027952 854440 30495792 3% /
/dev/root 33027952 854440 30495792 3% /
devtmpfs 447624 0 447624 0% /dev
tmpfs 89548 228 89320 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 179080 0 179080 0% /run/shm
觀察rootfs後,確定是已經使用/dev/sda1。
成功!
參考文章:
Boot from HD
http://forum.lemaker.org/thread-361-1-1-.html
http://forum.lemaker.org/3087-1-1-bananian_from_dev_sda1_.html
參考如何建立 Linux 與 swap 的partition
http://tldp.org/HOWTO/Partition/fdisk_partitioning.html
SDD drive for 16.04
http://forum.banana-pi.org/t/boot-m2-bananian-16-04-from-hdd-sdd/1646
沒有留言:
張貼留言