root@vincent:/# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000d63d3
Device Boot Start End Blocks Id System
/dev/sda1 2048 19531775 9764864 82 Linux swap / Solaris
/dev/sda2 * 19531776 214843391 97655808 83 Linux
/dev/sda3 214843392 1953523711 869340160 83 Linux
Disk /dev/sdb: 1007 MB, 1007681536 bytes
9 heads, 8 sectors/track, 27335 cylinders, total 1968128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sdb1 253 1968127 983937+ b W95 FAT32
//注意,如果sd卡分区已经mount到系统了,应该先umount:umount /media/***,不然后续操作会出现问题
root@vincent:/# fdisk /dev/sdb //注意此处不是sdb1,而是sdb,sdb1是sdb的第一个分区,当前这个sdb卡只有一个分区
Command (m for help): m
Command 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 partition's 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): o
Building a new DOS disklabel with disk identifier 0xc0238ad2.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdb: 1007 MB, 1007681536 bytes
9 heads, 8 sectors/track, 27335 cylinders, total 1968128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc0238ad2
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 1): 1
First sector (2048-1968127, default 2048): //此处直接回车即可
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1968127, default 1968127): +256M
Command (m for help): p
Disk /dev/sdb: 1007 MB, 1007681536 bytes
9 heads, 8 sectors/track, 27335 cylinders, total 1968128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc0238ad2
Device Boot Start End Blocks Id System
/dev/sdb1 2048 526335 262144 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 2): //此处直接回车即可
Using default value 2
First sector (526336-1968127, default 526336): //此处直接回车即可
Using default value 526336
Last sector, +sectors or +size{K,M,G} (526336-1968127, default 1968127): //此处直接回车即可
Using default value 1968127
Command (m for help): w //必须输入“w”上面的分区才会保存下来
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
root@vincent:/# fdisk -l
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x000d63d3
Device Boot Start End Blocks Id System
/dev/sda1 2048 19531775 9764864 82 Linux swap / Solaris
/dev/sda2 * 19531776 214843391 97655808 83 Linux
/dev/sda3 214843392 1953523711 869340160 83 Linux
Disk /dev/sdb: 1007 MB, 1007681536 bytes
31 heads, 62 sectors/track, 1024 cylinders, total 1968128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf3878a60
Device Boot Start End Blocks Id System
/dev/sdb1 2048 526335 262144 83 Linux
/dev/sdb2 526336 1968127 720896 83 Linux
root@vincent:/file# mkfs.vfat -F 32 -n boot /dev/sdb1 //fat32分区,boot是分区的名字
mkfs.vfat 3.0.9 (31 Jan 2010)
root@vincent:/file# mkfs.ext3 -L system /dev/sdb2 //ext3分区,system是分区的名字
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=system
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
45120 inodes, 180224 blocks
9011 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=184549376
6 block groups
32768 blocks per group, 32768 fragments per group
7520 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
拔掉SD卡,重新插上,就可以检测到一个boot和system两个分区