博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux sfdisk partition
阅读量:4058 次
发布时间:2019-05-25

本文共 3053 字,大约阅读时间需要 10 分钟。

为什么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

83Linux分区标识

 

Ubootkernel是直接使用dd写入mmcblk0中的,而分区则是使用sfdisk进行的,空出了ubootkernel的位置,从起始地址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.

 

转载地址:http://wnzji.baihongyu.com/

你可能感兴趣的文章
VC++ MFC SQL ADO数据库访问技术使用的基本步骤及方法
查看>>
VUE-Vue.js之$refs,父组件访问、修改子组件中 的数据
查看>>
Python自动化之pytest常用插件
查看>>
Python自动化之pytest框架使用详解
查看>>
【正则表达式】以个人的理解帮助大家认识正则表达式
查看>>
性能调优之iostat命令详解
查看>>
性能调优之iftop命令详解
查看>>
非关系型数据库(nosql)介绍
查看>>
移动端自动化测试-Windows-Android-Appium环境搭建
查看>>
Xpath使用方法
查看>>
移动端自动化测试-Mac-IOS-Appium环境搭建
查看>>
Selenium之前世今生
查看>>
Selenium-WebDriverApi接口详解
查看>>
Selenium-ActionChains Api接口详解
查看>>
Selenium-Switch与SelectApi接口详解
查看>>
Selenium-Css Selector使用方法
查看>>
Linux常用统计命令之wc
查看>>
测试必会之 Linux 三剑客之 sed
查看>>
Socket请求XML客户端程序
查看>>
Java中数字转大写货币(支持到千亿)
查看>>