
apsync将树莓派板载的无线网卡作为无线热点使用,我们可以使用笔记本电脑的无线网卡连接到树莓派。将tf卡插入树莓派上,再给树莓派插上网线,接通电源启动raspbian系统,下载putty 连接它,ip可以在路由器的客户端列表上看到。整个树莓派的小车系统分两步来搭建,首先是搭建树莓派的计算机系统树莓派usb启动,虽然是一个袖珍的计算机,但是“麻雀虽小,五脏俱全”,除去树莓派的主板外,还需准备一套标准通用的usb键盘鼠标,一个显示器(在本文描述的是一个用于车载监控设备的7寸显示器,通过rca接口相连),一块电池用于整个系统供电,最后也是最关键的需要准备预装了debian系统的sd卡(对于sd卡要求读写最好在4mb/s以上、容量大于2gb,当然容量更大速度越快更好)。
以下是U盘安装树莓派系统,利用U盘启动Raspberry的教程。

)c 盘 win xp d 盘 win7 e 盘 mac os f 盘用于 mac 硬盘安装写入镜像g 盘和 i 盘存放你的各类文件注:当然你也可以把 win7 和 mac os 装到其它盘里。不需要解压和写入镜像的u盘安装ubuntuserver方法。1、电脑插上 u 盘,打开 ultraiso 软件,文件---打开,选择你下载好的centos-6.3-i386-bin-dvd1.iso 文件,点启动--写入硬盘镜像,在硬盘驱动器里面选择你的 u 盘(看清楚,千万别选错),写入方式默认为:usb-hdd+,然后点格式化。
格式化SD卡,然后将写好系统的U盘下的内容全部复制到SD卡根目录中。

修改SD卡根目录下的 cmdline.txt 文件。因为U盘现在有2个分区,一个是boot(/dev/sda1)分区,另一个才是root(/dev/sda2)分区。 将root=/dev/mmcblk0p2修改为root=/dev/sda2。
然后,将U盘和SD卡同时插到树莓派上,上电就可以将树莓派从U盘启动了。

启动后可以感受到,树莓派的运行速度快了许多,这是因为我们使用了速度更快的U盘安装系统。
U盘安装完系统后,发现虽然我的U盘是32G大小的,但是使用df命令可以看到只有4G大小,使用sudo raspi-config扩展,提示不能自动扩展:

sda2 is not an SD card. Don't know how to expand

这时需要使用fdisk命令手动扩展空间树莓派usb启动,信息过程如下。带有注释的行是需要输入的信息。
pi@raspberrypi:~ $ **sudo fdisk /dev/sda #扩展分区**
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p #查看现有分区
Disk /dev/sda: 28.7 GiB, 30752000000 bytes, 60062500 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: 0x2d52e4bb
Device Boot Start End Sectors Size Id Type
/dev/sda1 8192 137215 129024 63M c W95 FAT32 (LBA)
/dev/sda2 137216 60062499 59925284 28.6G 83 Linux
Command (m for help): d #删除分区2
Partition number (1,2, default 2): 2 #选择要删除的分区号
Partition 2 has been deleted.
Command (m for help): n #新建分区
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p #选择p,即为主分区
Partition number (2-4, default 2): 2 #选择要新建的分区号
First sector (2048-60062499, default 2048): 137216 #输入删除分区前/dev/sda2的起始磁盘柱
Last sector, +sectors or +size{K,M,G,T,P} (137216-60062499, default 60062499): #默认即可
Created a new partition 2 of type 'Linux' and of size 28.6 GiB.
Command (m for help): p #查看修改后的分区
Disk /dev/sda: 28.7 GiB, 30752000000 bytes, 60062500 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: 0x2d52e4bb
Device Boot Start End Sectors Size Id Type
/dev/sda1 8192 137215 129024 63M c W95 FAT32 (LBA)
/dev/sda2 137216 60062499 59925284 28.6G 83 Linux
Command (m for help): wq #保存退出
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
然后重启系统 sudo reboot。
4、点击更新固件,然后等待重启路由器,重启完成后即安装完成。如果缩小的是系统盘,分区助手可能会提示你电脑需要重启,这个操作需要在重启模式下执行,这时需要点击“是”以让程序在重启模式下完成这些等待执行的操作。因redis是单线程模型(single-threaded server),即一次只能执行一个命令,如果命令耗时较长,其他命令就会被阻塞,进入队列排队等待。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-104155-1.html
打倒一切来犯之敌