Centos 6.9 上有一个相当大的文件服务器(~85TB)运行 xfs 文件系统,我们用它来进行备份。
由于空间不足,我向阵列添加了 10 个类似的新驱动器,并使用 Mega Raid Manager 重建了 RAID 6,这花了近两周的时间。因此,总容量约为 150 TB,加上虚拟驱动器,约为 135 TB。
我计划使用“parted”来扩大分区大小:
[root@backup-serv ~]# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the
space (an extra 14649917440 blocks) or continue with the current setting?
Fix/Ignore? Ignore
Model: LSI SMC3108 (scsi)
Disk /dev/sdb: 150TB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 90.0TB 90.0TB 1
笔记:文件系统不显示任何内容。
我有 60 TB 的可用空间,如下所示:
(parted) print free
Model: LSI SMC3108 (scsi)
Disk /dev/sdb: 150TB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
24.6kB 1049kB 1024kB Free Space
1 1049kB 90.0TB 90.0TB 1
90.0TB 150TB 60.0TB Free Space
它显示有 60 TB 的可用空间。因此,当我尝试扩展“分区 1”时,我收到以下信息(无法检测文件系统错误)。:
(parted) resize
WARNING: you are attempting to use parted to operate on (resize) a file system.
parted's file system manipulation code is not as robust as what you'll find in
dedicated, file-system-specific packages like e2fsprogs. We recommend
you use parted only to manipulate partition tables, whenever possible.
Support for performing most operations on most types of file systems
will be removed in an upcoming release.
Partition number? 1
Start? [1049kB]? 1049kB
End? [90.0TB]? 130.0TB
Error: Could not detect file system.
df 输出:
[root@backup-serv ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/Root_VG-Root
ext4 107G 78G 24G 77% /
tmpfs tmpfs 32G 0 32G 0% /dev/shm
/dev/sda1 ext4 870M 154M 672M 19% /boot
/dev/sdb1 xfs 82T 81T 1.2T 99% /export/bak
为什么 parted 无法检测文件系统?
答案1
我猜想旧版本的 parted 可能不太好。
我在 USB 上使用 Gparted Live(最新 parted 版本)并启动了它。这似乎让它工作了!我能够使用“调整部分大小“。
最后,重新启动后,文件系统使用“xfs_growfs“。
df 输出:
[root@backup-serv ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/Root_VG-Root
ext4 107G 78G 24G 77% /
tmpfs tmpfs 32G 0 32G 0% /dev/shm
/dev/sda1 ext4 870M 154M 672M 19% /boot
/dev/sdb1 xfs 119T 81T 38T 69% /export/bak
答案2
我们来尝试另外一个命令来看看是否是parted的bug:
lsblk -f
或者
blkid