Linux系统数据盘在线扩容
1、卸载数据盘
[root@localhost ~]# umount /dev/sdb1
2、使用fdisk /dev/sdb 对数据盘分区操作
[root@localhost ~]# fdisk /dev/sdb WARNING: The size of this disk is 3.0 TB (3000034656256 bytes). DOS partition table format can not be used on drives for volumes larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID partition table format (GPT). Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p Disk /dev/sdb: 3000.0 GB, 3000034656256 bytes, 5859442688 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 Disk label type: dos Disk identifier: 0x000b6f25 Device Boot Start End Blocks Id System /dev/sdb1 2048 1048578047 524288000 83 Linux Command (m for help): d Selected partition 1 Partition 1 is deleted Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): Using default response p Partition number (1-4, default 1): First sector (2048-4294967295, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): +1300G Partition 1 of type Linux and of size 1.3 TiB is set Command (m for help): p Disk /dev/sdb: 3000.0 GB, 3000034656256 bytes, 5859442688 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 Disk label type: dos Disk identifier: 0x000b6f25 Device Boot Start End Blocks Id System /dev/sdb1 2048 2726299647 1363148800 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
3、检查文件系统
[root@localhost ~]# e2fsck -f /dev/sdb1 e2fsck 1.42.9 (28-Dec-2013) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/sdb1: 13/32768000 files (0.0% non-contiguous), 3714898/131072000 blocks
4、变更文件系统大小
[root@localhost ~]# resize2fs /dev/sdb1 resize2fs 1.42.9 (28-Dec-2013) Resizing the filesystem on /dev/sdb1 to 340787200 (4k) blocks. The filesystem on /dev/sdb1 is now 340787200 blocks long.
5、重新挂载
[root@localhost ~]# mount -a [root@localhost ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext4 99G 3.5G 90G 4% / devtmpfs devtmpfs 16G 0 16G 0% /dev tmpfs tmpfs 16G 0 16G 0% /dev/shm tmpfs tmpfs 16G 9.2M 16G 1% /run tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup /dev/sda1 ext4 477M 122M 326M 28% /boot /dev/sda5 ext4 142G 942M 134G 1% /var tmpfs tmpfs 3.2G 16K 3.2G 1% /run/user/0 /dev/loop0 iso9660 4.1G 4.1G 0 100% /mnt /dev/sdb1 ext4 1.3T 6.2G 1.2T 1% /storage
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App