LINUX中使用fdisk对SD卡磁盘进行格式化并重新分区
1、df -h查看sd卡是否已經(jīng)掛載,如果已經(jīng)掛載,使用umount指令先卸載掉。
2、cat proc/partitions查看sd卡的分區(qū)名
3、fdisk /dev/mmcblk1
輸入m查看,輸入p查看當(dāng)前分區(qū)配置情況
Command (m for help): p
p
Disk /dev/mmcblk1: 1947 MB, 2041577472 bytes, 3987456 sectors
62304 cylinders, 4 heads, 16 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk1p1 0,1,1 1023,3,16 16 1024015 1024000 500M c Win95 FAT32 (LBA)
/dev/mmcblk1p2 1023,3,16 1023,3,16 1024016 3987455 2963440 1446M c Win95 FAT32 (LBA)
4、如果已經(jīng)存在分區(qū),先將這些分區(qū)刪除掉
輸入d,如果有多個(gè)就多次輸入d
5、開始新增兩個(gè)盤,輸入n新增,輸入p打印查看,輸入t修改格式類型(輸入l能查看所有支持的類型), c Win95 FAT32 (LBA)是FAT格式,最后輸入w進(jìn)行保存配置
Command (m for help): n n Partition typep primary partition (1-4)e extended p p Partition number (1-4): 2 2 First sector (1024016-3987455, default 1024016): Using default value 1024016 Last sector or +size{,K,M,G,T} (1024016-3987455, default 3987455): Using default value 3987455Command (m for help): t t Partition number (1-4): 2 2 Hex code (type L to list codes): l l0 Empty 1b Hidden Win95 FAT32 9f BSD/OS 1 FAT12 1c Hidden W95 FAT32 (LBA) a0 Thinkpad hibernation 4 FAT16 <32M 1e Hidden W95 FAT16 (LBA) a5 FreeBSD 5 Extended 3c Part.Magic recovery a6 OpenBSD 6 FAT16 41 PPC PReP Boot a8 Darwin UFS 7 HPFS/NTFS 42 SFS a9 NetBSD a OS/2 Boot Manager 63 GNU HURD or SysV ab Darwin boot b Win95 FAT32 80 Old Minix b7 BSDI fs ... Hex code (type L to list codes): c c Changed system type of partition 2 to c (Win95 FAT32 (LBA))Command (m for help): p p Disk /dev/mmcblk1: 1947 MB, 2041577472 bytes, 3987456 sectors 62304 cylinders, 4 heads, 16 sectors/track Units: sectors of 1 * 512 = 512 bytesDevice Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk1p1 0,1,1 1023,3,16 16 1024015 1024000 500M c Win95 FAT32 (LBA) /dev/mmcblk1p2 1023,3,16 1023,3,16 1024016 3987455 2963440 1446M c Win95 FAT32 (LBA)Command (m for help): w w6、創(chuàng)建好后,需要進(jìn)行格式化一下,我這里都格式化成vfat
mkdosfs -F 32 /dev/mmcblk1p1
mkdosfs -F32 /dev/mmcblk1p2
7、最后掛載到想要的目錄就可以了
mount -t vfat /dev/mmcblk1p1 /mnt/sdcard
mount -t vfat /dev/mmcblk1p2 /mnt/sdcard2
查看一下,兩個(gè)目錄都掛載成功了,可以分別使用了
ls -al
total 8
drwxr-xr-x 4 root root 80 Jan 2 14:25 .
drwxr-xr-x 20 root root 460 Jan 2 14:19 …
drwxrwxrwx 2 root root 4096 Jan 1 1970 sdcard
drwxrwxrwx 2 root root 4096 Jan 1 1970 sdcard2
總結(jié)
以上是生活随笔為你收集整理的LINUX中使用fdisk对SD卡磁盘进行格式化并重新分区的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ajax不能访问本地php文件,php
- 下一篇: windows组件中没有IIS解决方法