linux u盘合并分区,Linux U盘分区格式化 fdisk命令

news/2024/10/19 2:17:20/

Linux U盘分区格式化 fdisk命令

今天为方便修复系统,做了个U盘WINPE的启动盘。当我兴高采烈的将这个U盘

插到Linux虚拟机上却发现出现了4个分区,而且根本就挂不上,顿时便郁闷了!

看来这样的分区Linux识别不了。只有用个专门的U盘来当启动盘了。这个U盘我

还得用来拷资料呢,那就乖乖的恢复它吧。

首先想到的是在windows下格式化,这是最简单的了。一试,没用,分区表格不了

看来得用命令行的删除分区信息的工具了,无奈,对windows 命令不熟悉,只能

放弃了。。。

于是想到了linux下fdisk这个东东,以前没仔细研究过,看来是刚拿来研究的时

候了。

google找了个教程,作为参考:

-------------------------------------------------------------

#fdisk /dev/sdb    /*进入fdisk命令操作空间*/

#Command (m for help): m     /*命令查看*/

Command action

a   toggle a bootable flag引导扇区

b   edit bsd disklabel     编辑卷标(linux下使用的卷标bsd通用)

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): p

Disk /dev/sdb: 2055 MB, 2055208960 bytes

64 heads, 62 sectors/track, 1011 cylinders

Units = cylinders of 3968 * 512 = 2031616 bytes

Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         133      263871+   6  FAT16

/dev/sdb2   *         134         200      132928   83  Linux          /*boot 分区*/

#Command (m for help): d

#Partition number (1-4): 1

Command (m for help): p

Disk /dev/sdb: 2055 MB, 2055208960 bytes

64 heads, 62 sectors/track, 1011 cylinders

Units = cylinders of 3968 * 512 = 2031616 bytes

Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System

/dev/sdb2   *         134         200      132928   83  Linu

#Command (m for help): d

Selected partition 2

#Command (m for help): p                                           /*查看此时已无分区*/

Disk /dev/sdb: 2055 MB, 2055208960 bytes

64 heads, 62 sectors/track, 1011 cylinders

Units = cylinders of 3968 * 512 = 2031616 bytes

Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System

#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.

Syncing disks.

/*下边给磁盘增加一分区并格式化*/

#ls /dev/sd*

#/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb

#Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

#p                                                                                                  /*增加主分区*/

#Partition number (1-4): 1

#First cylinder (1-1011, default 1):                                         /*回车默认*/

Using default value 1

#Last cylinder, +cylinders or +size{K,M,G} (1-1011, default 1011):                       /*回车默认*/

Using default value 1011

#Command (m for help): p                                            /*此时有sdb1分区*/

Disk /dev/sdb: 2055 MB, 2055208960 bytes

64 heads, 62 sectors/track, 1011 cylinders

Units = cylinders of 3968 * 512 = 2031616 bytes

Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        1011     2005793   83  Linux

#Command (m for help): w                                   /*最后写入分区表*/

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

#sudo mkfs.vfat -F 32 -n disk /dev/sdb1           /*格式化*/

下面便是磁盘格式化了 命令是mkfs.ext3 设备名 这里的设备名要是分区名 , 而不是硬盘设备名 (切记先记好分区名 , 别输入错 , 不然格式化错了就麻烦了)

等待之后分区就格式化好了 , 记得复制之前要一下

再次提示下修复命令 fsck.ext3 设备名

-----------------------------------------------------------------------


http://www.ppmy.cn/news/714084.html

相关文章

U盘分区合并的教程详解

注:转载文章感谢原作者 大家都知道电脑的硬盘分区一般是4个,分的区越多对硬盘损害大,而且损失的空间也越大,而U盘也是如此。一般买来的U盘都是只有一个区,有些朋友会用了软件把U盘分成了4个区,但发现损失了…

Mac分区合并

对于已经安装了Mac和Windows双系统的用户,想要彻底删除Boot Camp Windows分区,然后合并到Mac分区中,步骤如下: 1、打开「终端」输入代码 diskutil list,并按【Return】来显示所有磁盘信息,记下 BOOTCAMP 盘…

linux下u盘分区合并,Linux下对U盘的分区与格式化

项目系统要求的对U盘分区,分出系统盘与用户盘。这就有了今天的这个总结了: 1.输入命令“fdisk -l”查看设备挂载的位置,因为这个在设备挂载的时候有可能会发生变化。 假设设备挂载到了 /dev/sdc 需要对该设备进行分区 2.输入命令“fdisk /dev/sdc”进入分区功能: a.在此状态…

U盘的分区与合并

u盘分区的具体操作: 步骤1、将u盘插入到电脑,接着组合键“winr”打开运行,输入“cmd”按回车键。 步骤2、在打开的窗口中输入“diskpart”,按回车键执行。 步骤3、再输入“select disk 1”命令(注意:写1就是一个u盘&am…

python 深度学习 解决遇到的报错问题2

目录 一、解决报错UnicodeDecodeError: utf-8 codec cant decode byte 0xe3 in position 15: invalid continuation byte 二、解决ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based pro 三、解决OSError: [WinError 1314…

π221N61 低功耗5.0kVrms 双向I²C隔离器 兼容Si8602AD-B-IS

π221N61荣湃深力科兼容IC接口的低功耗双 向隔离器,IC隔离器输入和输出采用二氧化硅(SiO2) 介质隔离,可阻断高电压并防止噪声电流进入控制侧,避 免电路干扰和损坏敏感器件。π221N61 是基于荣湃智能分压专利技术设计 的产品,与光电…

HTML培训心得体会五篇(合集)

HTML5培训心得一 关于html5培训心得总结? 一:了解HTML5前端开发技术? ?? HTML?指的是超文本标记语言?(Hyper?Text?Markup?Language),标记语言是一套标记标签?(markup?tag),HTML?使用标记标签来描述网页。HTML5区别于HTML的标…

照片如何恢复?试试这3个简单操作!

我的电脑里保存了很多照片,都是对我来说意义重大的,但最近电脑内存不足了,在清理内存时,我不小心把照片也清空了,这些照片应该如何恢复呢?谁有什么好的方法恢复电脑里的照片吗? 可能很多人都会选…