首页 > 系统相关 >记一次ubuntu系统磁盘无法挂载之gdisk命令的使用

记一次ubuntu系统磁盘无法挂载之gdisk命令的使用

时间:2023-06-15 18:12:08浏览次数:57  
标签:partition backup ubuntu bytes dev 挂载 GPT gdisk table

可以使用fdisk -l查看到磁盘分区信息但实际上并未成功

(base) root@ywb:~# fdisk -l

......

The primary GPT table is corrupt, but the backup appears OK, so that will be used.
Disk /dev/sde: 4.6 TiB, 5000981077504 bytes, 9767541167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 01000000-0000-0000-4E41-435239463342

Device      Start        End    Sectors  Size Type
/dev/sde1      40     409639     409600  200M EFI System
/dev/sde2  411648 9767540735 9767129088  4.6T Microsoft basic data

我们这里可以看到明显的报错

The primary GPT table is corrupt, but the backup appears OK, so that will be used.
(base) root@ywb:~# ll -d /dev/sde2
ls: cannot access '/dev/sde2': No such file or directory

我们可以使用gdisk命令进行修复损坏的分区

(base) root@ywb:~# gdisk /dev/sde
GPT fdisk (gdisk) version 1.0.3

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Caution! After loading partitions, the CRC doesn't check out!
Warning! Main partition table CRC mismatch! Loaded backup partition table
instead of main partition table!

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

# 可以看到磁盘的GPT分区有问题
# 然后输入r进行修复
Command (? for help): r
# 然后我们输入问号
# 这里列出了一些我们可能用到的指令,这里我们只会用到b
Recovery/transformation command (? for help): ?
b	use backup GPT header (rebuilding main)
c	load backup partition table from disk (rebuilding main)
d	use main GPT header (rebuilding backup)
e	load main partition table from disk (rebuilding backup)
f	load MBR and build fresh GPT from it
g	convert GPT into MBR and exit
h	make hybrid MBR
i	show detailed information on a partition
l	load partition data from a backup file
m	return to main menu
o	print protective MBR data
p	print the partition table
q	quit without saving changes
t	transform BSD disklabel partition
v	verify disk
w	write table to disk and exit
x	extra functionality (experts only)
?	print this menu
# 输入b,然后什么也不会显示
Recovery/transformation command (? for help): b

# 继续输入w,写入备份的GPT分区数据重建磁盘
Recovery/transformation command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sde.
The operation has completed successfully.

# ok,到这里,磁盘就修复完成了

再次查看磁盘分区就没有报错了

(base) root@ywb:~# fdisk -l

......

Disk /dev/sde: 4.6 TiB, 5000981077504 bytes, 9767541167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 01000000-0000-0000-4E41-435239463342

Device      Start        End    Sectors  Size Type
/dev/sde1      40     409639     409600  200M EFI System
/dev/sde2  411648 9767540735 9767129088  4.6T Microsoft basic data
# 成功挂载
(base) root@ywb:~# mount /dev/sde2 /datasets

标签:partition,backup,ubuntu,bytes,dev,挂载,GPT,gdisk,table
From: https://www.cnblogs.com/ywb123/p/17483703.html

相关文章

  • ubuntu 安装 nv驱动
    今天将Ubuntu从9.10升级到10.04后显卡驱动遇到了点小麻烦:不能像以前那样安装Nvidia官方驱动了。据说是因为10.04自带了开源的nouveau驱动所至。因此要手动安装官方驱动先得卸载ubuntu10.04安装时缺省提供的这个驱动。折腾一番后安装成功,简单总结一下安装官方驱动的两个方法:手......
  • 虚拟机内安装Ubuntu 22.04.2 LTS
    Ubuntu系统下载|Ubuntu文件->新建虚拟机-> 下一步: 下一步: 下一步: 下一步: 注:路径用全英文下一步: 下一步: 下一步:下一步: 下一步: 下一步:下一步: 下一步: 下一步: 自定义硬件: 注:移除打印机新CD/DVD(SATA)->使用ISO映像文件->浏览关闭......
  • ubuntu开发stm32单片机-环境搭建
    1、首先安装串口助手(ch340驱动)首先查看操作系统中自带的串口驱动arvin@arvin-virtual-machine:/lib/modules/5.19.0-43-generic/kernel/drivers/usb/serial$lsaircable.kof81232.koiuu_phoenix.komxuport.koquatech2.kousbserial.koark3116.k......
  • Ubuntu 22.04 SSH 设置
    允许rootssh登录#给root设置密码passwdroot#修改配置cp/etc/ssh/sshd_config/etc/ssh/sshd_config.orivi/etc/ssh/sshd_configPermitRootLoginyes#重启sshd服务systemctlrestartsshd开启秘钥认证和关闭密码认证注意事项,可以先开启秘钥认证,秘钥认......
  • CentOS搭建NFS服务、windows挂载权限问题; NFS读写缓慢调优
    CentOS搭建NFS服务、windows挂载权限问题CentOS和统信UOS(与ubuntu一样)命令不一样,但操作大同小异,参考如下:https://blog.csdn.net/wangzongyu/article/details/127009158 windows读写linux搭建的NFS内文件是比较慢,调优:https://blog.csdn.net/yysalad/article/details/11736623......
  • Ubuntu 防火墙命令
    在Ubuntu系统进行安装的时候默认安装了ufw防火墙1、查看防火墙状态$sudoufwstatusStatus:inactive#表示不活跃如果没有安装ufw防火墙可以使用命令安装:$sudoapt-getinstallufw2、开启防火墙$sudoufwenable3、关闭防火墙$sudoufwdisable4、重启uf......
  • Ubuntu常用命令
    查看CPU温度:echo$[$(cat/sys/class/thermal/thermal_zone0/temp)/1000]°实时观看:watch-n0.1echoCPU:$[$(cat/sys/class/thermal/thermal_zone0/temp)/1000]°PC直接查看:#查看第一个核心$cat/proc/acpi/thermal_zone/TZS0/temperature#查看第二个核心......
  • Ubuntu安装Python 3.10
    更新系统的软件包列表和软件包:sudoaptupdatesudoaptupgrade安装构建Python3.10所需的依赖项:sudoaptinstallbuild-essentialzlib1g-devlibncurses5-devlibgdbm-devlibnss3-devlibssl-devlibsqlite3-devlibreadline-devlibffi-devcurllibbz2-dev下载Python3.10......
  • ubuntu20.4安装geant4和root
    1.下载需要的软件包和数据包下载roothttps://root.cern/install/all_releases  下载geant4https://geant4.web.cern.ch/download/all  2.准备安装文件在home目录下面创建一个geant4的文件夹打开geant4文件夹,在里面创建一个file的文件夹将下载好的14个文件拖动到......
  • Ubuntu 源代码编译安装 Nginx
    建立nginx用户和用户组sudogroupaddnginxsudouseraddnginx-gnginx-s/sbin/nologin-M在线安装依赖sudoapt-yinstallgccmakeopenssllibssl-devlibpcre3libpcre3-devlibgd-devvimwgetnet-tools下载并解压nginx源代码wgethttp://nginx.org/download/nginx-1.24......