cubieboard nand重新分区扩容

来源:互联网 发布:mac 双屏 dock 切换 编辑:程序博客网 时间:2024/06/11 18:56

cubieboard nand 重新分区扩容

我的是 cb2 板a20 cpu ,nand 为4G,装的是cb-a20-lubuntu-server-13.06-v1.00 系统,

系统默认根分区为2G 还有2G是闲置的。


一:安装分区工具 nand-part (sunxi-tools)

#sudo apt-get install git#sudo apt-get install  build-essential#sudo apt-get install pkg-config libusb-1.0#git clone https://github.com/linux-sunxi/sunxi-tools.git#cd sunxi-tools#make all

<span style="font-family: Arial; line-height: 26px; background-color: rgb(255, 255, 255);">二:查看分区</span>

<span style="font-family: Arial, Helvetica, sans-serif;">#fdisk -l</span>

Disk /dev/nand: 4085 MB, 4085252096 bytes255 heads, 63 sectors/track, 496 cylinders, total 7979008 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/nand doesn't contain a valid partition tableDisk /dev/nanda: 33 MB, 33554432 bytes255 heads, 63 sectors/track, 4 cylinders, total 65536 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000     Device Boot      Start         End      Blocks   Id  SystemDisk /dev/nandb: 16 MB, 16777216 bytes255 heads, 63 sectors/track, 2 cylinders, total 32768 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x78303d78Disk /dev/nandb doesn't contain a valid partition tableDisk /dev/nandc: 33 MB, 33554432 bytes255 heads, 63 sectors/track, 4 cylinders, total 65536 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/nandc doesn't contain a valid partition tableDisk /dev/nandd: 2147 MB, 2147483648 bytes255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/nandd doesn't contain a valid partition tableDisk /dev/nande: 1837 MB, 1837105152 bytes255 heads, 63 sectors/track, 223 cylinders, total 3588096 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0xffffffffDisk /dev/nande doesn't contain a valid partition table
/dev/nande  是空闲的,是留给用户使用的,有两种方法使用,一个是用户格式化后直接挂载,还有一个是把它扩充到根分区里。


三,方法一:用户格式化挂载:

#mkfs.ext4 /dev/nande#mkdir /userdata#mount -vl -t ext3 /dev/nande /userdata// 自动挂载#vi /etc/fstab/dev/nande     /userdata      ext4      defaults      1      2  中间用 “TAB” 隔离
方法二:把剩余容量扩充到根分区


1. 查看nand 分区结构:

# ./nand-part -f a20 /dev/nand
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
5 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =    65536user_type=0
partition  2: class =         DISK, name =          env, partition start =    98304, partition size =    32768user_type=0
partition  3: class =         DISK, name =         boot, partition start =   131072, partition size =    65536user_type=0
partition  4: class =         DISK, name =       rootfs, partition start =   196608, partition size =  4194304 user_type=0
partition  5: class =         DISK, name =        UDISK, partition start =  4390912, partition size =  3342336 user_type=0

红色为区的名字,绿色是区的起点。

rootfs  主分区(UDISK将被扩充到这个区),它的大小是 size =4194304  ;4194304/1024/2=2048 = 2G 
UDISK 就是空闲的分区,它的大小为 size =3342336
两个区的合并总容量: 4194304+ 3342336 = 7536640  7536640  / 1024 / 2 = 3680 = 3.6G
注意 : bootloader, env , boot ,这三个分区是不能动的,


分区命令分析:

./nand-part -f a20 /dev/nand 32768 "bootloader65536" "env32768" "boot65536" "rootfs7536640"

a20  -- 是指cpu ,a10 的cpu 改为 a10

其它值以颜色对应分区的大小(起始和结束)


2 执行:

#./nand-part -f a20 /dev/nand 32768 "bootloader 65536" "env 32768" "boot 65536" "rootfs 7536640"

3. 重新计算

# fsck -f /dev/nandd#resize2fs /dev/nandd#reboot         // 重启#df -hlFilesystem      Size  Used Avail Use% Mounted on/dev/nandd      3.68G  939M  2.6G  27% /none            4.0K     0  4.0K   0% /sys/fs/cgroupnone             91M  180K   91M   1% /runnone            5.0M  4.0K  5.0M   1% /run/locknone            454M     0  454M   0% /run/shmnone            100M     0  100M   0% /run/user




0 0
原创粉丝点击