怎样在linux下对U盘进行格式化和分区
1、首先通过命令fdisk -l 在root命令下查看U盘的分区信息。
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):
4、输入p可以浏览当前设备的分区信息,如下所示:
Disk /dev/sdb: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders, total 15523840 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: 0x13561963
Device Boot Start End Blocks Id System
/dev/sdb1 2048 268287 133120 83 Linux
/dev/sdb2 268288 15523839 7627776 83 Linux
Command (m for help):
5、可以看到上面有两个分区,现在我删除这两个分区,d命令:
Partition number (1-4): 1
Command (m for help): d
Selected partition 2
Command (m for help):
6、确定是否分区被删除了,在通过p命令:
Disk /dev/sdb: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders, total 15523840 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: 0x13561963
Device Boot Start End Blocks Id System
Command (m for help):
可以看出没有了分区信息,删除分区成功。
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-15523839, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-15523839, default 15523839): +200M //设定此分区的大小
Command (m for help):
第一个分区已经新建完毕。
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 2):
Using default value 2
First sector (411648-15523839, default 411648):
Using default value 411648
Last sector, +sectors or +size{K,M,G} (411648-15523839, default 15523839): //没有写,就表示剩下的空间都是此分区的。
Using default value 15523839
Command (m for help):
按照默认的就可以了,这样分区就完成了。
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
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)
Syncing disks.
上面分区成功,但是我们想要自己的文件系统,比如分区1是fat格式的,分区2是ext2格式的,这样怎样处理呢?非常重要的命令mkfs
mkfs.bfs mkfs.ext2 mkfs.ext4 mkfs.minix mkfs.ntfs
root@samarxie:~# mkfs.vfat -F 32 -n fat /dev/sdb1
mkfs.vfat 3.0.12 (29 Oct 2011)
root@samarxie:~# mkfs.ext2 -F -L ext2 /dev/sdb2
mke2fs 1.42 (29-Nov-2011)
文件系统标签=ext2
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
472352 inodes, 1889024 blocks
94451 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=1937768448
58 block groups
32768 blocks per group, 32768 fragments per group
8144 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: 完成
正在写入inode表: 完成
Writing superblocks and filesystem accounting information:
完成
root@samarxie:~#
怎样在linux下对U盘进行格式化和分区的更多相关文章
- 实现Linux下的U盘(USB Mass Storage)驱动
如何实现Linux下的U盘(USB Mass Storage)驱动 版本:v0.7 How to Write Linux USB MSC (Mass Storage Class) Driver Cri ...
- 如何实现Linux下的U盘(USB Mass Storage)驱动
如何实现Linux下的U盘(USB Mass Storage)驱动 版本:v0.7 How to Write Linux USB MSC (Mass Storage Class) Driver Cri ...
- linux下挂载U盘
转:http://www.cnblogs.com/yeahgis/archive/2012/04/05/2432779.html linux下挂载U盘 一.Linux挂载U盘: 1.插入u盘到计算机, ...
- Arch Linux下Visual Stdio Code在格式化C代码时报错
libtinfo.so.5: cannot open shared object file: No such file or directory Arch Linux下Visual Stdio Cod ...
- LINUX下的U盘挂载
linux下如果没有图形界面的情况下就要我们自己熟悉命令来挂载U盘,下面给大家详细描述下U盘的挂载过程. 1. 插入U盘 2. #sudo fdisk –l 查看所挂载盘符名称如下图,假设盘符名称为s ...
- linux下给U盘分区&制作文件系统
这几天读到TLCL-Storage Media一节,不由的想要折腾一下U盘,一直以来U盘只是被拿来暂存数据,其内部有没有文件系统,数据怎么管理,那是从来也不清楚,本文就依葫芦画瓢,折腾下手中的King ...
- linux下挂载U盘【转】
转自:http://www.cnblogs.com/yeahgis/archive/2012/04/05/2432779.html 一.Linux挂载U盘:1.插入u盘到计算机,如果目前只插入了一个u ...
- linux下转换U盘文件系统
打算在windows 7 下复制一个12G 的文件至U盘,无奈U盘为FAT32格式,最大支持移动4G 的文件,只能将U盘文件系统格式化为NTFS.windows 7系统出现问题,转化中总是出现错误.故 ...
- linux下挂载U盘方法
1.使用 cat /proc/partitions 查看系统现在有哪些分区:[root@localhost ~]# cat /proc/partitions major minor #blocks ...
随机推荐
- strip() 、lstrip() 、rstrip()
strip() 用于移除字符串开头和结尾的空格或换行符,如果指定参数,则表示移除指定的字符lstrip() 用于移除字符串开头的空格或换行符,如果指定参数,则表示移除指定的字符rstrip() 用于移 ...
- Android中Parcelable和Serializable接口用法
1. Parcelable接口 Interface for classes whose instances can be written to and restored from a Parcel. ...
- Runtime 应用(一)拦截系统自带的方法交换实现
动态的交换方法能够给项目中大量已经使用的方法 进行拦截增加操作 实践:利用运行时交换系统的ImageNamed:方法 应用背景 当系统需要适配ios7和ios8时可能会有显示不同图片的需求,但在老项目 ...
- 【MySQL】查询时强制区分大小写的方法
MySQL默认的查询也不区分大小写.但作为用户信息,一旦用户名重复,又会浪费很多资源.再者,李逵.李鬼的多起来,侦辨起来很困难.要做到这一点,要么在建表时,明确大小写敏感(字段明确大小写敏感) sql ...
- LeetCode——Best Time to Buy and Sell Stock
Description: Say you have an array for which the ith element is the price of a given stock on day i. ...
- webpack中,require的五种用法
a.js: module.exports = function(x){ console.log(x); } 一,commonjs同步: var b = require('./a');b('你好')// ...
- session.setAttribute和session.getAttribute
网上搜了些资料 ----------------------------------------------------------------------------- B/S架构中,客户端与服务器 ...
- Atlassian Confluence任意文件读取漏洞
Atlassian Confluence Atlassian Confluence是澳大利亚Atlassian公司的一套专业的企业知识管理与协同软件,也可以用于构建企业WiKi.该软件可实现团队成员之 ...
- rest_framework之规范详解 00
接口开发 方式1:缺点:如果有10张表,则需要40个url. urls.py views.py 缺点:如果有10张表,则需要40个url. 接下来就出现了resrful 规范,比较简洁 方式2: ...
- 记录web项目部署到阿里云服务器步骤
(使用 web项目.阿里云服务器.Xftp.Xshell),敬请参考和指正 1.将要部署的项目打包成WAR文件格式,可以在MyEclipse.Eclipse都可以完成打包,如下图: 2.安装Xshel ...