当前位置 博文首页 > lyndon:linux 设备新增分区
三步走:
命令: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 type
p 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
命令:mke2fs、mkfs、mkfs.ext2、mkfs.ext3、mkfs.ext4、mkfs.fat、mkfs.jffs2 …
mke2fs -T ext4 /dev/mmcblk1p3
命令:mount
mount -t ext4 /dev/mmcblk1p3 /userconfig/config
这里是我的一个实际例子:banana pi 开发板上使用 32G SD卡作为 flash,系统实际只占用了前面一部分空间,然后我从 SD卡后面未使用部分选一段空间出来新建一个分区进行使用。