linux sfdisk partition
来源:互联网 发布:爱福窝软件 增加隔断 编辑:程序博客网 时间:2024/05/21 22:50
为什么SD卡在Linux下/dev下的设备名叫mmcblk0p1?
SD/MMC卡的设备构造差不多,MMC应该是 SD的前身,不过 MMC当时的设计比SD小一半。
所以,SD/MMC的驱动通用,进一步的,Linux的设备节点就延续了 MMC的这个名字,后面的 blk是块设备这个英文的简写, mmcblk也就是“mmc/sd块设备”,0就是这个 mmc/sd设备的顺序编号,p1就是第一个分区。
#!/bin/sh
# partition size in MB
BOOT_ROM_SIZE=10 MBR数据区,10MB
ROOT_SYSTEM_SIZE=150
# call sfdisk to create partition table
# destroy the partition table
node=$1
dd if=/dev/zero of=${node} bs=1024 count=1清除分区表MBR
sfdisk --force -uM ${node} << EOF
${BOOT_ROM_SIZE},${ROOT_SYSTEM_SIZE},83
,,83 将其他所有空间再分成一个区,,此处应该就是mmcblk0p2了。
EOF
83是Linux分区标识
Uboot和kernel是直接使用dd写入mmcblk0中的,而分区则是使用sfdisk进行的,空出了uboot和kernel的位置,从起始地址10MB开始的。
INPUT FORMAT
sfdisk reads lines of the form
<start> <size> <id><bootable> <c,h,s> <c,h,s>
where each line fills one partition descriptor.
Fields are separated by whitespace, or comma or semicolon possiblyfollowed by whitespace; initial and trailing whitespace is ignored. Numbers can be
octal, decimal or hexadecimal, decimal is default. When a field is absent or empty, a defaultvalue is used.
The <c,h,s> parts can (and probably should) be omitted - sfdiskcomputes them from <start> and <size> and the disk geometry asgiven by the kernel or speci鈥?
fied using the -H, -S, -C flags.
Bootable is specified as [*|-], with as default not-bootable. (The value of this field is irrelevant forLinux - when Linux runs it has been booted already
- but might play a role for certain boot loadersand for other operating systems. Forexample, when there are several primary DOS partitions, DOS assigns
C: to the first among these that is bootable.)
Id is given inhex, without the 0x prefix, or is [E|S|L|X], where L (LINUX_NATIVE (83)) is thedefault, S is LINUX_SWAP (82), E is EXTENDED_PARTITION (5),
and X is LINUX_EXTENDED (85).
The default value of start is the first nonassigned sector/cylinder/...
The default value of size is as much as possible (until next partitionor end-of-disk).
However, for the four partitions inside an extended partition, thedefaults are: Linux partition, Extended partition, Empty, Empty.
But when the -N option (change a single partition only) is given, the defaultfor each field is its previous value
EXAMPLE
The command
sfdisk /dev/hdc << EOF
0,407
,407
;
;
EOF
will partition /dev/hdc just as indicated above.
The command
sfdisk/dev/hdb << EOF
,3,L
,60,L
,19,S
,,E
,130,L
,130,L
,130,L
,,L
EOF
will partition /dev/hdb into two Linux partitions of 3 and60 cylinders, a swap space of 19 cylinders, and an extended partition coveringthe rest. Inside
the extended partition there are four Linux logical partitions, three of130 cylinders and one covering the rest.
With the -x option, the number of input lines must be a multiple of 4:you have to list the two empty partitions that you never want using twoblank lines.
Without the -x option, you giveone line for the partitions inside a extended partition, instead of four, andterminate with end-of-file (^D). (Andsfdisk
will assume that your input line represents the first of four, that thesecond one is extended, and the 3rd and 4th are empty.
- linux sfdisk partition
- linux sfdisk partition
- linux-sfdisk 用法
- linux-sfdisk用法
- Linux sfdisk 命令
- Linux shell--sfdisk manual
- linux-sfdisk用法说明
- Linux下sfdisk分区命令
- linux command sfdisk -s & hdparm -t /dev/sdb & tcpdump
- sfdisk 用法
- linux partition
- linux partition
- fdisk,cfdisk,sfdisk
- partition image备份linux
- linux+partition+bakup
- linux partition table on PC
- Partition
- PARTITION
- CAS技术原理及分析
- C++成长历程 之 小项目
- 使用jquery的lazy loader插件实现图片的延迟加载
- 局部特征
- CSS框架-SASS 用法指南
- linux sfdisk partition
- 集合映射
- Drools Planner(第1.1章节)
- CURD中添加操作存在的问题?
- Java RMISecurityManager
- 简单awk 命令
- Mjpg-Streamer 拍照功能移植
- inte123
- C++中的bitset容器