Ubuntu 下格式化 分区U盘SD 卡

大概有两种方式:命令行方式或图形界面方式

             1.命令行

  1. sudo fdisk -l  
查看你的设备的符号,显示结果通常如下:
  1. Disk /dev/sda: 500.1 GB, 500107862016 bytes  
  2. 255 heads, 63 sectors/track, 60801 cylinders  
  3. Units = cylinders of 16065 * 512 = 8225280 bytes  
  4. Sector size (logical/physical): 512 bytes / 512 bytes  
  5. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  6. Disk identifier: 0x000c4c5b  
  7.   
  8.    Device Boot      Start         End      Blocks   Id  System  
  9. /dev/sda1   *           1       60065   482466816   83  Linux  
  10. /dev/sda2           60065       60802     5917697    5  Extended  
  11. /dev/sda5           60065       60802     5917696   82  Linux swap / Solaris  
  12.   
  13. Disk /dev/sdb: 1954 MB, 1954545664 bytes  
  14. 255 heads, 63 sectors/track, 237 cylinders  
  15. Units = cylinders of 16065 * 512 = 8225280 bytes  
  16. Sector size (logical/physical): 512 bytes / 512 bytes  
  17. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  18. Disk identifier: 0x00069760  
找到你的设备的盘符,我的是 /dev/sdb
  1. sudo umount /dev/sdb  
  1. sudo fdisk /dev/sdb  
在终端显示内容如下:
  1. Command (m for help):  
输入m得到帮助信息:
  1. Command action  
  2.    a   toggle a bootable flag  
  3.    b   edit bsd disklabel  
  4.    c   toggle the dos compatibility flag  
  5.    d   delete a partition  
  6.    l   list known partition types  
  7.    m   print this menu  
  8.    n   add a new partition  
  9.    o   create a new empty DOS partition table  
  10.    p   print the partition table  
  11.    q   quit without saving changes  
  12.    s   create a new empty Sun disklabel  
  13.    t   change a partition's system id  
  14.    u   change display/entry units  
  15.    v   verify the partition table  
  16.    w   write table to disk and exit  
  17.    x   extra functionality (experts only)  
开始分区

如果你的设备已经有分区,先删除你的分区:

  1. Command (m for help): d 删除命令  
  2. Partition number (1-4): 1 删除地几个分区  
  1. 如果有多个分区,接着执行命令d,输入分区号  
创建新分区:
  1. Command (m for help): n   创建分区命令  
  2. Command action  
  3.    e   extended  
  4.    p   primary partition (1-4)  
  5. p                          选择分区的类型 e:扩展分区 p:主分区  
  6. Partition number (1-4): 1  分区号 1:第一个分区  
  7. First cylinder (1-237, default 1): 1  
  8. Last cylinder, +cylinders or +size{K,M,G} (1-237, default 237): +512M 分区的大小  
创建第二个分区:同上
  1. Command (m for help): n  
  2. Command action  
  3.    e   extended  
  4.    p   primary partition (1-4)  
  5. p  
  6. Partition number (1-4): 2  
  7. First cylinder (67-237, default 67):   
  8. Using default value 67  
  9. Last cylinder, +cylinders or +size{K,M,G} (67-237, default 237): +512M   
把第一个分区做为FAT32d 分区:
  1. Command (m for help): t 改变分区的id  
  2. Partition number (1-4): 1 改变第一个分区  
  3. Hex code (type L to list codes): c 变为dos兼容的格式  
  4. Changed system type of partition 1 to c (W95 FAT32 (LBA))  
查看分区情况:
  1. Command (m for help): p  
  2.   
  3. Disk /dev/sdb: 1954 MB, 1954545664 bytes  
  4. 255 heads, 63 sectors/track, 237 cylinders  
  5. Units = cylinders of 16065 * 512 = 8225280 bytes  
  6. Sector size (logical/physical): 512 bytes / 512 bytes  
  7. I/O size (minimum/optimal): 512 bytes / 512 bytes  
  8. Disk identifier: 0x00069760  
  9.   
  10.    Device Boot      Start         End      Blocks   Id  System  
  11. /dev/sdb1               1          66      530113+   c  W95 FAT32 (LBA)  
  12. /dev/sdb2              67         132      530145   83  Linux  

保存写入上面的内容:
  1. Command (m for help): w  
  2. The partition table has been altered!  
  3.   
  4. Calling ioctl() to re-read partition table.  
  5.   
  6. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.  
  7. The kernel still uses the old table. The new table will be used at  
  8. the next reboot or after you run partprobe(8) or kpartx(8)  
  9.   
  10. WARNING: If you have created or modified any DOS 6.x  
  11. partitions, please see the fdisk manual page for additional  
  12. information.  
  13. Syncing disks.  


格式化分区:
  1. sudo mkfs.vfat -F 32 -n boot /dev/sdb1 //boot是为分区起的名字,就是在硬盘上显示的名字 格式化位fat32格式 第一个分区<pre name="code" class="html">sudo mkfs.ext3 -L linux_fs /dev/sdb2 // linux_fs 是第二个分区的名字,格式化位 ext3格式</pre><br>  
  2. <p></p>  
  3. <pre></pre>  
  4. OK,Over。  
  5. <p></p>  
  6. <p><br>  
  7. </p>  

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值