热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

linux设备新增分区

三步走:新建分区格式化分区(给分区创建文件系统)挂载1.新建分区命令:fdisk#fdiskdevmmcblk1T

三步走:

  1. 新建分区
  2. 格式化分区(给分区创建文件系统)
  3. 挂载

1. 新建分区

命令:fdisk

/# fdisk /dev/mmcblk1
The number of cylinders for this disk is set to 12231.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/mmcblk1: 30 GB, 31914983424 bytes, 62333952 sectors
12231 cylinders, 98 heads, 52 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk1p1 12,190,51 45,97,52 204800 729087 524288 256M c Win95 FAT32 (LBA)
/dev/mmcblk1p2 143,6,49 1023,97,52 729088 14000000 13270913 6479M 83 Linux
Command (m for help): n
Partition typep primary partition (1-4)e extended
p
Partition number (1-4): 3
First sector (52-62333951, default 52): 60000000
Last sector or +size{,K,M,G,T} (60000000-62333951, default 62333951):
Using default value 62333951
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy

2. 格式化分区(给分区创建文件系统)

命令:mke2fs、mkfs、mkfs.ext2、mkfs.ext3、mkfs.ext4、mkfs.fat、mkfs.jffs2 …
mke2fs -T ext4 /dev/mmcblk1p3

3. 挂载

命令:mount
mount -t ext4 /dev/mmcblk1p3 /userconfig/config

实例

这里是我的一个实际例子:banana pi 开发板上使用 32G SD卡作为 flash,系统实际只占用了前面一部分空间,然后我从 SD卡后面未使用部分选一段空间出来新建一个分区进行使用。


推荐阅读
author-avatar
手浪用户2602901267
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有