大概有两种方式:命令行方式或图形界面方式
1.命令行
查看你的设备的符号,显示结果通常如下:sudo fdisk -l找到你的设备的盘符,我的是 /dev/sdbDisk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 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: 0x000c4c5b Device Boot Start End Blocks Id System /dev/sda1 * 1 60065 482466816 83 Linux /dev/sda2 60065 60802 5917697 5 Extended /dev/sda5 60065 60802 5917696 82 Linux swap / Solaris Disk /dev/sdb: 1954 MB, 1954545664 bytes 255 heads, 63 sectors/track, 237 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: 0x00069760sudo umount /dev/sdb在终端显示内容如下:sudo fdisk /dev/sdb输入m得到帮助信息:Command (m for help):开始分区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): d 删除命令 Partition number (1-4): 1 删除地几个分区创建新分区:如果有多个分区,接着执行命令d,输入分区号创建第二个分区:同上Command (m for help): n 创建分区命令 Command action e extended p primary partition (1-4) p 选择分区的类型 e:扩展分区 p:主分区 Partition number (1-4): 1 分区号 1:第一个分区 First cylinder (1-237, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-237, default 237): +512M 分区的大小把第一个分区做为FAT32d 分区:Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (67-237, default 67): Using default value 67 Last cylinder, +cylinders or +size{K,M,G} (67-237, default 237): +512M查看分区情况:Command (m for help): t 改变分区的id Partition number (1-4): 1 改变第一个分区 Hex code (type L to list codes): c 变为dos兼容的格式 Changed system type of partition 1 to c (W95 FAT32 (LBA))Command (m for help): p Disk /dev/sdb: 1954 MB, 1954545664 bytes 255 heads, 63 sectors/track, 237 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: 0x00069760 Device Boot Start End Blocks Id System /dev/sdb1 1 66 530113+ c W95 FAT32 (LBA) /dev/sdb2 67 132 530145 83 Linux
保存写入上面的内容: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: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks.格式化分区:
sudo mkfs.vfat -F 32 -n boot /dev/sdb1 //boot是为分区起的名字,就是在硬盘上显示的名字 格式化位fat32格式 第一个分区sudo mkfs.ext3 -L linux_fs /dev/sdb2 // linux_fs 是第二个分区的名字,格式化位 ext3格式
OK,Over。
2.图形界面:
需要安装分区工具:GParted,在Ubuntu 的软件中心搜索GParted,然后下载安装:
完成之后,在终端执行 sudo gpartedbin
在右上角选择你的设备是 /dev/sdb 2G的SD 卡
第一个按钮图标是创建新的分区:
可以选择分区的类型 Primary或者 Extended,分区的大小 New size(MB),分区的格式 ,添加标签 Label,标签是分区的名字我的第一个分区是 1024M, 主分区,FAT32 ,boot(分区的名字)
点击Add之后的结果为:
第二个分区的操作同上:结果为:
然后点击对勾的按钮,执行:
执行完毕就OK
OK,that‘s all
本文介绍了在Ubuntu系统下如何通过命令行和图形界面工具GParted来格式化U盘或SD卡。对于命令行,首先删除已有分区,然后创建新的分区并指定类型、大小和格式。在图形界面中,安装GParted,选择设备,创建分区,设置属性后执行操作。








4224

被折叠的 条评论
为什么被折叠?



