我最近安装的 ubuntu 16.04 系统运行不正常(无法启动)。我确实使用 fdisk 检查了硬盘驱动器的状态,发现备份 GPT 表不知何故已损坏。
ubuntu@ubuntu:~$ sudo fdisk -lu /dev/sda
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: gpt
Disk identifier: 574A30DA-2F2E-414A-A537-2E3E2B4F46FA
Device Start End Sectors Size Type
/dev/sda1 4096 611463167 611459072 291.6G Linux …Run Code Online (Sandbox Code Playgroud) 我正在查看一个使用 SD 卡创建的图像文件,dd并以 Raspbian(上面有我不久前编译的 Qt 5.7)作为输入。调用时
sudo parted raspbian_jessie_qt5.7_all_modules.img unit s print
Run Code Online (Sandbox Code Playgroud)
我明白了
Error: Can't have a partition outside the disk!
Run Code Online (Sandbox Code Playgroud)
fdisk我使用以下命令检查了分区
sudo fdisk -lu rasp_jessie_qt5.7.img
Run Code Online (Sandbox Code Playgroud)
具有以下输出
Disk rasp_jessie_qt5.7.img: 7.8 GiB, 8328838656 bytes, 16267263 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
Disklabel type: dos
Disk identifier: 0x65a3fac2
Device Boot Start End Sectors Size Id Type
rasp_jessie_qt5.7.img1 8192 131071 …Run Code Online (Sandbox Code Playgroud) 我有一个 Inteno dg200 路由器,运行一些 Iopsys linux 版本(我相信内核 3.14 左右)
我在使用 USB 端口和外部硬盘运行文件共享时遇到了一些问题。系统支持。但无论我放入什么,它都不会自动挂载。因此,今天我决定以 root 身份 ssh 进入系统,而不是使用基于 Web 的控制面板。
令我惊讶的是,该系统不支持在已连接的未安装驱动器上查找信息的常用方法。请允许我详细说明一下:
# fdisk -l
-ash: fdisk: not found
Run Code Online (Sandbox Code Playgroud)
很好,那么让我们尝试其他方法:
# lsblk
-ash: lsblk: not found
Run Code Online (Sandbox Code Playgroud)
于是我开始遇到麻烦。根据我在网上了解到的情况,当人们遇到这个问题时,通常是因为fdisk位于/sbin中,而这不在他们的路径中,因为他们不是 root。好吧,我是这里的 root,但为了确定我检查了/sbin和/usr/sbin,但无济于事。两个目录都不包含任何名为fdisk或 的内容lsblk,该find命令也找不到任何名为 的内容fdisk。
有没有其他方法可以从 CLI 找出到底要安装什么,或者我可以安装fdisk在路由器上吗?
我们在 sdb 磁盘上运行 smartctl
smartctl -a /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-327.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
Smartctl open device: /dev/sdb failed: DELL or MegaRaid controller, please try adding '-d megaraid,N'
Run Code Online (Sandbox Code Playgroud)
根据 smartctl 的输出,我们将其更改为
smartctl -a -d megaraid,0 /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-327.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Vendor: TOSHIBA
Product: MG04SCA20ENY
.
.
Run Code Online (Sandbox Code Playgroud)
我根据第一条总线设置 - 0 (来自 smartctl --scan )
smartctl --scan …Run Code Online (Sandbox Code Playgroud) 当我使用 fdisk 创建新分区时出现错误
Partition #3 contains a ext4 signature
Do you want to remove the signature? [Y]es/[N]o:
Run Code Online (Sandbox Code Playgroud)
这个错误不是问题,但我想知道为什么当分区尚未使用文件系统创建时甚至会出现此错误。
创建分区时,我只有两个分区,即 #1 和 #2,根本没有第三个分区。那么分区上怎么会有 ext4 文件系统的签名呢?
在 GPT 分区上使用 fdisk 创建文件系统时,我注意到文件系统类型中有如下选项:
20 Linux filesystem 0FC63DAF-8483-4772-8E79-3D69D8477DE4
21 Linux server data 3B8F8425-20E0-4F3B-907F-1A25A76F98E8
22 Linux root (x86) 44479540-F297-41B2-9AF7-D131D5F0458A
23 Linux root (ARM) 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3
24 Linux root (x86-64) 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
25 Linux root (ARM-64) B921B045-1DF0-41C3-AF44-4C6F280D3FAE
26 Linux root (IA-64) 993D8D3D-F80E-4225-855A-9DAF8ED7EA97
27 Linux reserved 8DA63339-0007-60C0-C436-083AC8230908
28 Linux home 933AC7E1-2EB4-4F13-B844-0E14E2AEF915
29 Linux RAID A19D880F-05FC-4D3B-A006-743F0F84911E
Run Code Online (Sandbox Code Playgroud)
我在我的系统上使用了 Linux 文件系统、Linux root (x86_x4)、Linux home 以及 XFS、NilFS、EXT4 和 ReiserFS。
这些文件系统类型之间有什么区别?是否有一个手册页记录了所有这些内容?
我已经通过 KVM 从实时 netinstal iso USB 在服务器上远程安装了 Debian 10,但随后我遇到了这个奇怪的问题:
# fdisk -l
bash: fdisk: command not found
Run Code Online (Sandbox Code Playgroud)
但是,如果我使用/sbin/fdisk -l,该命令执行时不会出现任何问题。
我想知道是什么原因造成的以及如何解决它?
我想在主机上增加 ext4 卷,但我注意到没有有效的分区表可供删除和重制:
fdisk -u /dev/vdb
/dev/vdb: device contains a valid 'ext4' signature; it is strongly recommended to wipe the device with wipefs(8) if this is unexpected, in order to avoid possible collisions
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xd2971c02.
root@host:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 20G 0 disk
`-vda1 253:1 0 20G 0 part /
vdb 253:16 0 1T 0 disk /mnt/redacted
vdc …Run Code Online (Sandbox Code Playgroud) 这是缩小分区文件系统的方法/home:
e2fsck /dev/sda1
resize2fs /dev/sda1 150G
Run Code Online (Sandbox Code Playgroud)
截至目前,如果我运行df它,它将显示分区已从 210G 缩小到 150G(这不是真的)。
由于我只减小了文件系统大小,如何使用fdisk或缩小分区大小parted?
我有一个新的 4 TB Western Digital SN850X NVMe SSD 驱动器,我正在尝试将其分区作为 Ubuntu 20.04 的启动驱动器。无论我做什么,fdisk 都会报告分区未对齐,即使它们看起来与逻辑(512 字节)和物理(8388608 字节)扇区大小对齐:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 3.65 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model:
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 8388608 bytes
I/O size (minimum/optimal): 8388608 bytes / 8388608 bytes
Alignment offset: 6832128 bytes
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/sda1 16384 671743 655360 320M EFI System
/dev/sda2 671744 7814035455 7813363712 3.7T …Run Code Online (Sandbox Code Playgroud)