.net开发的网站有哪些,建筑工程网下载,wordpress 禁用一切更新 提示,淘宝联盟做网站Linux 硬盘扩容 分区 挂载
1. 添加分区
1.1. 查看新添加的硬盘
fdisk -l假设当前未挂载的盘符是/dev/sdb#xff0c;后文中所有操作都按挂载/dev/sdb 操作
1.2. 分区管理
小硬盘
fdisk /dev/sdb大硬盘#xff08;2TB以上#xff09;
gdisk /dev/sdb1.3. 编辑分…Linux 硬盘扩容 分区 挂载
1. 添加分区
1.1. 查看新添加的硬盘
fdisk -l假设当前未挂载的盘符是/dev/sdb后文中所有操作都按挂载/dev/sdb 操作
1.2. 分区管理
小硬盘
fdisk /dev/sdb大硬盘2TB以上
gdisk /dev/sdb1.3. 编辑分区
⚠️ 下方注释一行一行看不要跳过
# 执行完 fdisk /dev/sdb 后命令行会出现以下交互式命令行
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.GPT PMBR size mismatch (2048 ! 1935671295) will be corrected by write.
The backup GPT table is not on the end of the device.
This problem will be corrected by write.# 1.3.1. 输入 n, 创建一个新分区
Command (m for help): n
Partition number (4-128, default 4):
First sector (2048-1935671295, default 2048):
Last sector, /-sectors or /-size{K,M,G,T,P} (2048-1935671295, default 1935671295):Created a new partition 4 of type Linux filesystem and of size 923 GiB.# 1.3.2. 输入 t, 改变当前分区的文件格式
Command (m for help): t
Partition number (1-4, default 1):
# 这里需要注意一下有的系统是8e有的系统是31
# 可以L查看列表查询LVM格式的编号需要分区格式为Linux LVM
Partition type (type L to list all types): 8e
Changed type of partition Linux filesystem to Linux LVM. # 1.3.3. 输入 p, 打印出当前硬盘的分区表信息, 查看硬盘分区是否创建成功
# 部分硬盘过大可能无法正常创建部分Linux内核无法创建过大的硬盘分区如2TB以上需要通过gdisk进行分区
# 如果下方 /dev/sdb1 那一行的 Size列 显示的硬盘大小不是你和创建的硬盘大小直接退出使用gdisk重新执行
Command (m for help): p
Disk /dev/sdb: 923 GiB, 991063703552 bytes, 1935671296 sectors
Disk model: QEMU HARDDISK
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: 0x7568f956Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1935671295 1935669248 923G 8e Linux LVM# 1.3.4. 输入 w, 写入分区并退出交互式命令行
Command (m for help): w
The partition table has been altered.
Syncing disks.2. 重读硬盘分区表
通过partprobe⼯具让内核重读硬盘分区表否则lsblk命令查看分区时⽆法看到刚刚新建的分区
partprobe /dev/sdb3. 格式化分区
格式化文件格式为mkfs.ext4
mkfs.ext4 /dev/sdb1 -N 16384004. 挂载硬盘 设置开机自动挂载
⚠️ 如果 /data 目录不存在需要先创建
⚠️ 不推荐使用已有目录进行挂载如/home目录但是可以挂载到其子目录下如/home/data
✅ 目录挂载后为使用方便可以使用软连接方式 ’ ln -s ’ 将目录软连接到你的工作目录下
4.1. 临时挂载硬盘
mount /dev/sdb1 /data4.2. 永久挂载硬盘
如果没有临时挂载需要重启服务器硬盘才会被挂载上
echo /dev/sdb1 /data ext4 defaults 0 0 /etc/fstab