Linux下SD卡分区操作说明.doc_第1页
Linux下SD卡分区操作说明.doc_第2页
Linux下SD卡分区操作说明.doc_第3页
Linux下SD卡分区操作说明.doc_第4页
Linux下SD卡分区操作说明.doc_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

LINUX下的SD卡分区 首先在windows下面使用HP格式化工具格式化SD卡,然后将SD卡接入Linux操作系统。识别SD卡后,打开终端。查看SD卡是否已经挂载,如果已经挂载需要先卸载再操作。可以通过mount来进行查看。输入mount,我们可以看到我们的盘符为sdb。在终端输入umount /media/FAT32将其卸载。 下面我们对S卡进行分区。首先我们看一下fdisk命令。指令:fdisk用途:观察硬盘之实体使用情形与分割硬盘用。1. 输入 m 显示所有命令列示。2. 输入 p 显示硬盘分割情形。3. 输入 a 设定硬盘启动区。4. 输入 n 设定新的硬盘分割区。4.1. 输入 e 硬盘为延伸分割区(extend)。4.2. 输入 p 硬盘为主要分割区(primary)。5. 输入 t 改变硬盘分割区属性。6. 输入 d 删除硬盘分割区属性。7. 输入 q 结束不存入硬盘分割区属性。8. 输入 w 结束并写入硬盘分割区属性。 在终端输入sudo fdisk /dev/sdb回车Command (m for help): d删除硬盘分割区属性如果你的卡上有几个分区Command (m for help): d回车删除硬盘分割区属性Partition number (1-): 1回车删除1分区,Command (m for help): d回车Partition number (1-): 2回车删除2分区根本你的卡里有几个区就一一删除分区。Command (m for help): 回车看下图,已经没有分区了现在我们开始建立分区,这里,我要把的卡建2个分区第一个是FAT32的分区(分4)Command (m for help): n 回车 e extended p primary partition (1-4)p回车partition uumber(1-4): 回车这是选分第个分区。first cylinder (1-17183,default 1):1回车这里1-17183是表示我的 8G卡的存储量。第一个区从开始。Last cylinder or +size or +sizeM or +sizeK (1-17183, default 17183): 4000M回车Command (m for help):现在分第二个区也是Linux主分区分出4。重复刚才分区的步骤Command (m for help): n 回车 e extended p primary partition (1-4)p回车partition uumber(1-4):2回车这是分第2个区。first cylinder (6501-17183,default 6501):6501回车Last cylinder or +size or +sizeM or +sizeK (6501-17183, default 17183): +4000M回车Command (m for help):=刚才起立好分区现在要改变硬盘分割区属性。Command (m for help):t回车Partition number (1-4): 1回车Hex code (type L to list codes): b 回车这里要们要设定这个区为w95 FAT323分区。Command (m for help):t 回车Partition number (1-4): 2 回车Hex code (type L to list codes): 83 回车这里要们要设定这个区为Linux EXT3分区。Command (m for help):a回车这里设定硬盘启动区Partition number (1-4): 1 回车Command (m for help):p可以看到刚才分区Command (m for help):w输入 q 结束不存入硬盘分割区属性。 输入 w 结束并写入硬盘分割区属性。执行 partprobe,它能使内核在不重启的情况接受新的分区表信息= 格式化分区输入sudo fdisk -l回车,查看分区信息。这时我们可以看到刚才把分的区/dev/sdb1 w95 FAT32/dev/sdb2 Linux首先确认sdb1已卸载(umount命令)在终端输入:(格式化第一分区) sudo mkfs.msdos -F 32 /dev/sdb1 -n FAT32在终端输入:(格式化第二分区)sudo mkfs.ext3 /dev/sdb2 -L EXT3 在 linux 下面卸载 SD 卡,将卡挂载在 windows 上面,然后在WINDOWS上“开始”“控制面板”“计算机管理”“磁盘管理”移动磁盘上,对第一个分区进行格式化 Linux下使用fdisk命令将高容量SD卡(SDHC)格成两个分区日期:2008-08-13来源:红联Linux 作者:清平乐字体:大 中 小 刚买了一个4G的TF卡,居然在我的智能山寨机coolo818上不能使用,因为coolo818最大支持2G的卡。于是,就想把高容量的SD卡格成两个2G的盘片来用。在 Fedora 8下,将一张4G的TF卡(MicroSD),格成两个2G的分区,一个主分区,一个逻辑分区。ps:SD卡有TF卡(现在通称MicroSD),SD卡,MiniSD卡,SDHC等多种,长的不一样;除此之外,还有一种MMC卡。指令:fdisk 用途:观察硬盘之实体使用情形与分割硬盘用。 使用方法: 一、在 console 上输入 fdisk -l /dev/sdb ,观察硬盘之实体使用情形。 二、在 console 上输入 fdisk /dev/sdb,可进入分割硬盘模式。 1. 输入 m 显示所有命令列示。 2. 输入 p 显示硬盘分割情形。 3. 输入 a 设定硬盘启动区。 4. 输入 n 设定新的硬盘分割区。 4.1. 输入 e 硬盘为延伸分割区(extend)。 4.2. 输入 p 硬盘为主要分割区(primary)。 5. 输入 t 改变硬盘分割区属性。 6. 输入 d 删除硬盘分割区属性。 7. 输入 q 结束不存入硬盘分割区属性。 8. 输入 w 结束并写入硬盘分割区属性。rootlocalhost # fdisk /dev/sdb #插入读卡器,在我电脑上显示是sdb,以下黑字为键入部分The number of cylinders for this disk is set to 189513.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): m #helpCommand action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partitions system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)Command (m for help): p #查看Disk /dev/sdb: 4075 MB, 4075290624 bytes7 heads, 6 sectors/track, 189513 cylindersUnits = cylinders of 42 * 512 = 21504 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id System/dev/sdb1 1 93007 1953144 c W95 FAT32 (LBA)/dev/sdb2 93008 189513 2026626 f W95 Extd (LBA)/dev/sdb5 93008 189513 2026623 c W95 FAT32 (LBA)Command (m for help): d Partition number (1-5): 1 #删除1分区,因为之前我已经分成两个区了,所以现在演示时显示有两个分区,总之,先删掉Command (m for help): dPartition number (1-5): 2 #删除2分区Command (m for help): dNo partition is defined yet!Command (m for help): pDisk /dev/sdb: 4075 MB, 4075290624 bytes7 heads, 6 sectors/track, 189513 cylindersUnits = cylinders of 42 * 512 = 21504 bytesDisk identifier: 0x00000000#以上为删除原有的分区Device Boot Start End Blocks Id SystemCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-189513, default 1): Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-189513, default 189513): +2048MCommand (m for help): tSelected partition 1Hex code (type L to list codes): L0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot 1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris 2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-4 FAT16 32M 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx 6 FAT16 42 SFS 86 NTFS volume set da Non-FS data 7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility 9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs f W95 Extd (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT 10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor 14 Hidden FAT16 3 61 SpeedStor a9 NetBSD f4 SpeedStor 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT 1c Hidden W95 FAT3 75 PC/IX Command (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-189513, default 1): Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-189513, default 189513): +2048MCommand (m for help): tSelected partition 1Hex code (type L to list codes): L0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot 1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris 2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-4 FAT16 32M 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx 6 FAT16 42 SFS 86 NTFS volume set da Non-FS data 7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility 9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs f W95 Extd (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT 10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor 14 Hidden FAT16 3 61 SpeedStor a9 NetBSD f4 SpeedStor 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT 1c Hidden W95 FAT3 75 PC/IX Hex code (type L to list codes): cChanged system type of partition 1 to c (W95 FAT32 (LBA)#以上为建2G的主分区,W95 FAT32 (LBA)类型Command (m for help): nCommand action e extended p primary partition (1-4)ePartition number (1-4): 2First cylinder (95240-189513, default 95240): Using default value 95240Last cylinder or +size or +sizeM or +sizeK (95240-189513, default 189513): Using default value 189513Command (m for help): tPartition number (1-5): 2Hex code (type L to list codes): fChanged system type of partition 2 to f (W95 Extd (LBA)#以上为创建扩展分区,类型为W95 Extd (LBA)Command (m for help): nCommand action l logical (5 or over) p primary partition (1-4)lFirst cylinder (95240-189513, default 95240): Using default value 95240Last cylinder or +size or +sizeM or +sizeK (95240-189513, default 189513): Using default value 189513Command (m for help): tPartition number (1-5): 5Hex code (type L to list codes): cChanged system type of partition 5 to c (W95 FAT32 (LBA)#以上为创建逻辑驱动器在扩展分区上,类型为W95 FAT32 (LBA)Command (m for help): pDisk /dev/sdb: 4075 MB, 4075290624 bytes7 heads, 6 sectors/track, 189513 cylindersUnits = cylinders of 42 * 512 = 21504 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id System/dev/sdb1 1 95239 2000016 c W95 FAT32 (LBA)/dev/sdb2 95240 189513 1979754 f W95 Extd (LBA)/dev/sdb5 95240 189513 1979751 c W95 FAT32 (LBA)Command (m for help): w #保存The partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.The kernel still uses the old table.The new table will be used at the next reboot.WARNING: If you have created or modified any DOS 6.xpartitions, please see the fdisk manual page for additionalinformation.Syncing disks.rootlocalhost # find /dev/sdb*/dev/sdb/dev/sdb1/dev/sdb2/dev/sdb5mkfs.vfat: /dev/sdb1 contains a mounted file system.rootlocalhost # mkfs.vfat /dev/sdb1mkfs.vfat 2.11 (12 Mar 2005)rootlocalhost # mkfs.vfat /dev/sdb5 mkfs.vfat 2.11 (12 Mar 2005)rootlocalhost # cd /mntrootlocalhost mnt# mkdir sd1 sd5rootlocalhost mnt# mount /dev/sdb1 sd1rootlocalhost mnt# mount /dev/sdb5 sd5 -#一下是两个2G的分区合并成一个4G的,方法类似,不在累述。rootlocalhost # fdisk /dev/sdbThe number of cylinders for this disk is set to 189513.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): mCommand action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partitions system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)Command (m for help): pDisk /dev/sdb: 4075 MB, 4075290624 bytes7 heads, 6 sectors/track, 189513 cylindersUnits = cylinders of 42 * 512 = 21504 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id System/dev/sdb1 1 95239 2000016 c W95 FAT32 (LBA)/dev/sdb2 95240 189513 1979754 f W95 Extd (LBA)/dev/sdb5 95240 189513 1979751 c W95 FAT32 (LBA)Command (m for help): dPartition number (1-5): 1Command (m for help): dPartition number (1-5): 2Command (m for help): d No partition is defined yet!Command (m for help): pDisk /dev/sdb: 4075 MB, 4075290624 bytes7 heads, 6 sectors/track, 189513 cylindersUnits = cylinders of 42 * 512 = 21504 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id SystemCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-189513, default 1): Using default value 1Last cylinder or +size or +sizeM or +sizeK (1-189513, default 189513): Using default value 189513Command (m for help): tSelected partition 1Hex code (type L to list codes): cChanged system type of partition 1 to c (W95 FAT32 (LBA)Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.The kernel still uses the old table.The new table will be used at the next reboot.WARNING: If you have created or modified any DOS 6.xpartitions, please see the fdisk manual page for additionalinformation.Syncing disks.linux下对SD卡分区 2011-07-21 13:43:54| 分类: 嵌入式开发 | 标签:linux sd卡分区 |举报|字号 订阅一 使用linux下的磁盘管理工具fdisksudo fdisk /dev/sdc /fdisk=format disk使用fdisk打开你的SD卡设备名称,我的sd卡设备名称是sdc二进入fdisk管理工具打开后进入如下界面WARNING: DOS-compatible mode is deprecated. Its strongly recommended to switch off the mode (command c) and change display units to sectors (command u).Command (m for help): mCommand action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partitions system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)Command (m for help):我们只需要使用到fdisk的的几个主要命令m:使用帮助n: 创建一个分区d: 删除一个分区p:打印分区信息t:修改分区ID,通过修改ID我们可以改变分区格式,例如windows的fat32格式id为6和linux下ext3格式id为83w:保存分区信息并退出三:创建分区1,打印显示已有分区输入pCommand (m for help): pDisk /dev/sdc: 1967 MB, 1967128576 bytes57 heads, 56 sectors/track, 1203 cylindersUnits = cylinders of 3192 * 512 = 1634304 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id System/dev/sdc1 1 23 36680 83 Linux/dev/sdc2 24 34 17556 83 Linux2,删除已有分区输入d之后选择分区编号Command (m for help): dPartition number (1-4): 1Command (m for help): dSelected partition 23,新建分区3.1建立主分区输入nCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-1203, default 1): 1Last cylinder, +cylinders or +sizeK,M,G (1-1203, default 1203): 23输入n后选择p建立一个主分区,选择分区编号为1,分区起始柱面位置(first cylinder)选择1,末端位置(last cylinder)选择233.2建立扩展分区Command (m for help): nCommand action e extended p primary partition (1-4)ePartition number (1-4): 2First cylinder (24-1203, default 24): Using default value 24Last cylinder, +cylinders or +sizeK,M,G (24-1203, default 1203): Using default value 1203输入n后选择e建立一个扩展分区,选择编号2,起始位置和末端选择默认的2410233.3建立逻辑分区Command (m for help): nCommand action l logical (5 or over) p primary partition (1-4)lFirst cylinder (24-1203, default 24): Using default value 24Last cylinder, +cylinders or +sizeK,M,G (24-1203, default 1203): 43输入n后选择l建立一个逻辑分区,选选择起始和末端位置为2443建立第二个逻辑分区Command (m for help): nCommand action l logical (5 or over) p primary partition (1-4)lFirst cylinder (44-1203, default 44): Using default value 44Last cylinder, +cylinders or +sizeK,M,G (44-1203, default 1203): Using default value 1203三修改分区ID输入tCommand (m for help): tPartition number (1-6): 1Hex co

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论