格式化

有时候我们的优盘内存还有很多,但是却无法再向优盘内写入,会显示只读字样,这时可以将优盘格式化,格式化的步骤如下(linux系统下)

1.先将优盘卸载

[root@localhost Note]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 82404032 47920848 34483184 59% /
devtmpfs 1872332 0 1872332 0% /dev
tmpfs 1881720 176 1881544 1% /dev/shm
tmpfs 1881720 9148 1872572 1% /run
tmpfs 1881720 0 1881720 0% /sys/fs/cgroup
/dev/loop0 3654720 3654720 0 100% /yum
/dev/sda6 508588 165928 342660 33% /boot
/dev/sdb4 7818112 7757624 60488 100% /run/media/root/GSP1RMCULXF
[root@localhost Note]# umount /run/media/root/GSP1RMCULXF/
[root@localhost Note]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 82404032 47920852 34483180 59% /
devtmpfs 1872332 0 1872332 0% /dev
tmpfs 1881720 176 1881544 1% /dev/shm
tmpfs 1881720 9140 1872580 1% /run
tmpfs 1881720 0 1881720 0% /sys/fs/cgroup
/dev/loop0 3654720 3654720 0 100% /yum
/dev/sda6 508588 165928 342660 33% /boot
[root@localhost Note]#

>
2.查看是否卸载成功

df -h

>
3.fdisk /dev/sdb 磁盘分区

`[root@localhost Note]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
`

>
4.查看帮助信息

`[root@localhost Note]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

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
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
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)
`

>
5.删除原有分区(d)

Command (m for help): d
Selected partition 1
Partition 1 is deleted

Command (m for help):

>
6. p 打印分区表

Command (m for help): p

Disk /dev/sdb: 8022 MB, 8022654976 bytes, 15669248 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 label type: dos
Disk identifier: 0xcad4ebea

Device Boot Start End Blocks Id System

Command (m for help):

>
7.创建新的分区表(n)(p:创建主分区; e:扩展分区)

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-15669247, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-15669247, default 15669247): 15669247
Partition 1 of type Linux and of size 7.5 GiB is set

Command (m for help):

>
8.wq 保存退出

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost Note]#

>
9.刷新分区表partprobe

[root@localhost Note]# partprobe
[root@localhost Note]#

>
10.用mkfs.vfat格式优盘

[root@localhost Note]# mkfs.vfat /dev/sdb1
mkfs.fat 3.0.20 (12 Jun 2013)
[root@localhost Note]#

11.最后查看分区是否创建成功

`[root@localhost Note]# cat /proc/partitions
major minor #blocks name

8 0 244198584 sda
8 1 73401344 sda1
8 2 1 sda2
8 5 83886080 sda5
8 6 512000 sda6
8 7 86394880 sda7
11 0 1048575 sr0
253 0 82444288 dm-0
253 1 3948544 dm-1
7 0 3655680 loop0
8 16 7834624 sdb
8 17 7833600 sdb1
[root@localhost Note]#
`

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值