查看磁盘挂载情况
[root@dm02 arcana]# fdisk -l Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x000c750f Device Boot Start End Blocks Id System /dev/vda1 * 2048 2099199 1048576 83 Linux /dev/vda2 2099200 209715199 103808000 8e Linux LVM Disk /dev/vdb: 1288.5 GB, 1288490188800 bytes, 2516582400 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 /dev/mapper/centos00-root: 106.3 GB, 106296246272 bytes, 207609856 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 /dev/vdb 1TB 未挂载
新磁盘分区:
fdisk /dev/vdb 参数说明: n:新建分区 p: 主分区 e: 扩展分区 上面可以默认回车,最后输入w (write)将操作写入磁盘 按顺序输入`n、p、1、w`
新磁盘分区命令
[root@dm02 arcana]# fdisk /dev/vdb 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. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x3b51a560. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-2516582399, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-2516582399, default 2516582399): Using default value 2516582399 Partition 1 of type Linux and of size 1.2 TiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
格式化刚划分的磁盘,格式成ext4格式:
[root@dm02 arcana]# mkfs.ext4 /dev/vdb mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 78643200 inodes, 314572800 blocks 15728640 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2462056448 9600 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
挂载文件目录:
新建/data目录
[root@dm02 arcana]# mkdir -p /data
写入开机自动挂载
[root@dm02 arcana]# echo "/dev/vdb /data ext4 defaults 0 0" >> /etc/fstab
挂载至目录/data:
[root@dm02 arcana]# mount -a
查看最新磁盘分布
[root@dm02 arcana]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 32G 0 32G 0% /dev tmpfs 32G 8.0K 32G 1% /dev/shm tmpfs 32G 42M 32G 1% /run tmpfs 32G 0 32G 0% /sys/fs/cgroup /dev/mapper/centos00-root 98G 9.1G 84G 10% / /dev/vda1 976M 163M 747M 18% /boot /dev/vdb 1.2T 77M 1.1T 1% /data
挂载成功!
本文来自博客园,作者:呱嗒呱嗒,转载请注明原文链接:https://www.cnblogs.com/auqiver/p/16006144.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通