linux下SD卡创建分区

一、对SD卡分区

1.将SD卡连接到PC机上,查看其设备名称

输入# dmesg|tail -20

......

[16392.819300] sd 16:0:0:0: [sdb] 31291392 512-byte logical blocks: (16.0 GB/14.9 GiB)
[16392.827038] sd 16:0:0:0: [sdb] Write Protect is off
[16392.827042] sd 16:0:0:0: [sdb] Mode Sense: 03 00 00 00
[16392.827044] sd 16:0:0:0: [sdb] Assuming drive cache: write through
[16392.848523] sd 16:0:0:0: [sdb] Assuming drive cache: write through
[16392.848530]  sdb: sdb1 sdb2
[16392.863252] sd 16:0:0:0: [sdb] Assuming drive cache: write through
[16392.863265] sd 16:0:0:0: [sdb] Attached SCSI removable disk

2.使用fdisk工具进入sdb(设备名)

输入# sudo fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help):进入到fdisk模式

3.查看分区

Command (m for help): p

Disk /dev/sdb: 16.0 GB, 16021192704 bytes
255 heads, 63 sectors/track, 1947 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4b0e64c8

   Device Boot      Start         End      Blocks   Id  System

如果有分区可以用“Command (m for help): d”删除分区

4.开始分区

Command (m for help): n

Command action
    e   extended
    p   primary partition (1-4)
 p(选择p)

Partition number (1-4): 1(第一个分区)

First cylinder (1-1947, default 1):直接回车
 Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1947, default 1947): +50MB(第一分区大小)

第二个分区

Command (m for help): n

Command action
    e   extended
    p   primary partition (1-4)
 p(选择p)

Partition number (1-4): 2 (第二个分区)

First cylinder (8-1947, default 8):直接回车
 Using default value 8

Last cylinder, +cylinders or +size{K,M,G} (8-1947, default 1947):直接回车(其他都为第二分区)
 Using default value 1947

5.查看分区

Command (m for help): p

Disk /dev/sdb: 16.0 GB, 16021192704 bytes
255 heads, 63 sectors/track, 1947 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4b0e64c8

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1           7       56196   83  Linux

/dev/sdb2               8        1947    15583050   83  Linux

6.修改分区类型,将第一分区改成“b W95 FAT32”格式

Command (m for help): t

Partition number (1-4): 1(修改第一分区)

Hex code (type L to list codes): L(查看类型列表)

 0  Empty           1e  Hidden W95 FAT1 80  Old Minix       bf  Solaris
  1  FAT12           24  NEC DOS         81  Minix / old Lin c1  DRDOS/sec (FAT-
  2  XENIX root      39  Plan 9          82  Linux swap / So c4  DRDOS/sec (FAT-
  3  XENIX usr       3c  PartitionMagic  83  Linux           c6  DRDOS/sec (FAT-
  4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  c7  Syrinx
  5  Extended        41  PPC PReP Boot   85  Linux extended  da  Non-FS data
  6  FAT16           42  SFS             86  NTFS volume set db  CP/M / CTOS / .
  7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set de  Dell Utility
  8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext df  'BootIt'
  9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       e1  DOS access
  a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e3  DOS R/O
  b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e4  'SpeedStor'
  c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs
  e 

你可能感兴趣的:(linux下SD卡创建分区)