磁盘容量为 105GB,但根目录 (/dev/sda3) 容量只有 39GB,我想增加容量。该怎么做?顺便说一下,操作系统是 Oracle Linux Server 7.9。
$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 11G 0 11G 0% /dev
tmpfs 11G 0 11G 0% /dev/shm
tmpfs 11G 115M 11G 2% /run
tmpfs 11G 0 11G 0% /sys/fs/cgroup
/dev/sda3 39G 23G 17G 58% /
/dev/sda1 200M 7.9M 192M 4% /boot/efi
tmpfs 2.1G 0 2.1G 0% /run/user/0
tmpfs 2.1G 0 2.1G 0% /run/user/1000
tmpfs 2.1G 0 2.1G 0% /run/user/994
$ fdisk -l
Disk /dev/sda: 105.2 GB, 105226698752 bytes, 205520896 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 97677311 48838655+ ee GPT
Partition 1 does not start on physical sector boundary.
$ cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="7.9"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Oracle Linux Server 7.9"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:9:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.9
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.9
答案1
我尝试了所有方法,但还是没能成功。我感觉我漏掉了一些步骤。
$ resize2fs /dev/sda3
resize2fs 1.45.4 (23-Sep-2019)
resize2fs: Bad magic number in super-block while trying to open /dev/sda3
Couldn't find valid filesystem superblock.
$ xfs_growfs /dev/sda3 -D size
meta-data=/dev/sda3 isize=256 agcount=4, agsize=2515200 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=0 finobt=0, sparse=0, rmapbt=0
= reflink=0
data = bsize=4096 blocks=10060800, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=4912, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data size unchanged, skipping
# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 11G 0 11G 0% /dev
tmpfs tmpfs 11G 0 11G 0% /dev/shm
tmpfs tmpfs 11G 115M 11G 2% /run
tmpfs tmpfs 11G 0 11G 0% /sys/fs/cgroup
/dev/sda3 xfs 39G 23G 17G 58% /
/dev/sda1 vfat 200M 7.9M 192M 4% /boot/efi
tmpfs tmpfs 2.1G 0 2.1G 0% /run/user/0
tmpfs tmpfs 2.1G 0 2.1G 0% /run/user/1000
tmpfs tmpfs 2.1G 0 2.1G 0% /run/user/994