CT开发板给nand分区,获得8G空间

post by rocdk890 / 2014-4-24 15:49 Thursday linux技术
  用PhoenixSuit给CubieTruck装了个Lunbutu-server版,但使用df命令查看到只有2G空间可以使用,再用fdisk查看了下,还真的是.

df -h查看结果:
root@cubietruck:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       2.0G  614M  1.3G  32% /
devtmpfs        889M  4.0K  889M   1% /dev
none            4.0K     0  4.0K   0% /sys/fs/cgroup
tmpfs            20M     0   20M   0% /tmp
none            197M  148K  197M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            985M     0  985M   0% /run/shm
none            100M     0  100M   0% /run/user


fdisk -l查看结果:
Disk /dev/nand: 7700 MB, 7700742144 bytes
255 heads, 63 sectors/track, 936 cylinders, total 15040512 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: 0x00000000

Disk /dev/nand doesn't contain a valid partition table

Disk /dev/nanda: 67 MB, 67108864 bytes
255 heads, 63 sectors/track, 8 cylinders, total 131072 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: 0x00000000

     Device Boot      Start         End      Blocks   Id  System

Disk /dev/nandb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 4194304 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: 0x00000000

Disk /dev/nandb doesn't contain a valid partition table

Disk /dev/nandc: 5469 MB, 5469372416 bytes
255 heads, 63 sectors/track, 664 cylinders, total 10682368 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: 0xffffffff

Disk /dev/nandc doesn't contain a valid partition table

解决办法:
nand-part nand设备 起始位置 '分区名称 长度' '分区名称2 长度2'

直接运行nand-part,会得到分区信息:
bootloader 起始位置32768 长度131072
rootfs 起始位置163840 长度4194304
UDISK 起始位置4358144 长度10584064

其中这些数字,都是以512字节为单位.

其中rootfs就是系统文件分区,而UDISK就是那5G多,而我们的目的就是把这5G的空间,合并到rootfs中,重新计算了一下,得到的命令就是:
nand-part /dev/nand 32768 'bootloader 131072' 'rootfs 14778368'

意思就是把/dev/nand重新分区,bootloader 的起始位置和长度必须保持不变,不然后果就是重新刷系统吧.这样的话,rootfs的起始位置也是原来的位置,所要修改的就是它的长度,为14778368.容量计算一下就是:14778368*512/1024/1024=7216MB,也就是7G,当然因为前面有bootloader分区,以及bootloader之前空出的一块,所以nandb自然是得不到完整的8G
命令成功执行,reboot,再resize2fs /dev/nandb 就成功了.

验证:
root@cubietruck:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.0G  614M  6.2G   9% /
devtmpfs        889M  4.0K  889M   1% /dev
none            4.0K     0  4.0K   0% /sys/fs/cgroup
tmpfs            20M     0   20M   0% /tmp
none            197M  148K  197M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            985M     0  985M   0% /run/shm
none            100M     0  100M   0% /run/user


可以看到根目录已经变成7G了.

fdisk -l的结果:
root@cubietruck:~# fdisk -l

Disk /dev/nand: 7700 MB, 7700742144 bytes
255 heads, 63 sectors/track, 936 cylinders, total 15040512 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: 0x00000000

Disk /dev/nand doesn't contain a valid partition table

Disk /dev/nanda: 67 MB, 67108864 bytes
255 heads, 63 sectors/track, 8 cylinders, total 131072 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: 0x00000000

     Device Boot      Start         End      Blocks   Id  System

Disk /dev/nandb: 7616 MB, 7616856064 bytes
255 heads, 63 sectors/track, 926 cylinders, total 14876672 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: 0x00000000

Disk /dev/nandb doesn't contain a valid partition table


可以看到/dev/nandb也变成了7616M了.
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-531.html

标签: 分区 CT CubieTruck CB3 开发板 nand 8G PhoenixSuit

评论: