@FM.ES.ZJU
任务24:boot device
接一个U盘或移动硬盘,从SD卡启动后,使得root设备是U盘或移动硬盘而不是SD卡
使用U盘能加速文件读取,特别适合手头没有大容量的sd卡,但有大容量U盘的情况。
好了,开始吧:
一、首先将镜像写入U盘,具体不多说了,跟第一个实验一样的操作,我是在windows下进行的。
二、准备SD卡,需要一个有一个FAT32格式分区的sd卡,可以在Linux下进行,当然,也可以在Windows下进行,本人选的是后者,对前者有兴趣的同学可以参考后文的参考。
三、将启动文件拷到SD卡上:
$ sudo mkdir /tmp/mnt_usb
$ sudo mkdir /tmp/mnt_sd
Mount the USBmemory stick.这里,sdj1应该是你的usb的设备名,注意是第一个分区哦。
$ sudo mount /dev/sdj1 /tmp/mnt_usb
Mount the SDcard.这里的sdf1应该是你的sd卡的设备名。
$ sudo mount /dev/sdf1 /tmp/mnt_sd
Copyacross the boot files from the USB memory stick to the SD card.
$ sudo cp /tmp/mnt_usb/* /tmp/mnt_sd/
Modifythe cmdline.txt file to tell the system where to find the root partition.
$ sudo vi/tmp/mnt_sd/cmdline.txt
(This is justchanging /dev/mmcblk0p2 (the 2ndpartition on the SD card) to/dev/sda2 (thesecond partition on the USB memory stick). This tells the Raspberri Pi devicewhere to find the root partition.
然后umount和rm的收尾工作了:
$ sudo umount /tmp/mnt_usb
$ sudo umount /tmp/mnt_sd
$ sudo rm -rf /tmp/mnt_usb
$ sudo rm -rf /tmp/mnt_sd
可以看到,/dev/sda是4099MB,就是那个U盘的大小,看到系统运行时u 盘亮闪闪的就好了~
参考:
Raspbian on Raspberry Pi using SD card + USBmemory stick
欢迎网友们指正~