linux 硬盘格式化工具 的使用
来源:互联网 发布:小型单片机项目外包网 编辑:程序博客网 时间:2024/06/04 08:37
- linux 硬盘格式化工具 的使用
- 查看现在的磁盘使用状况
- 格式化硬盘创建分区
- 使用 fdisk 命令
- 使用 parted 命令
- 格式化文件系统以及挂载
- 格式化文件系统
- 挂载
linux 硬盘格式化工具 的使用
公司新到了两台服务器,系统都已经装好了,但有个RAID没有挂载使用,所以有了这篇文章。
查看现在的磁盘使用状况
首先 df -Th
先查看一下现在的目录挂载情况,已经文件系统的类型。
[root@xxx ~]# df -ThFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/centos-root xfs 1.1T 16G 1.1T 2% /devtmpfs devtmpfs 32G 0 32G 0% /devtmpfs tmpfs 32G 0 32G 0% /dev/shmtmpfs tmpfs 32G 9.1M 32G 1% /runtmpfs tmpfs 32G 0 32G 0% /sys/fs/cgroup/dev/sda1 xfs 197M 157M 41M 80% /boottmpfs tmpfs 6.3G 0 6.3G 0% /run/user/0
因为使用了 LVM 所以 单独给 /boot
分配了 200MB,主目录挂载的对象显示为/dev/mapper/centos-root
。而且文件系统为 xfs 。
使用 fdisk -l
查看磁盘的使用情况。
[root@xxx~]# fdisk -lDisk /dev/sda: 1199.2 GB, 1199168290816 bytes, 2342125568 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk label type: dosDisk identifier: 0x00044d27 Device Boot Start End Blocks Id System/dev/sda1 * 2048 411647 204800 83 Linux/dev/sda2 411648 2342125567 1170856960 8e Linux LVMDisk /dev/sdb: 8000.5 GB, 8000450330624 bytes, 15625879552 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos-root: 1130.2 GB, 1130239098880 bytes, 2207498240 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos-swap: 68.7 GB, 68715282432 bytes, 134209536 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes
可以看到 第一块磁盘大小为 1.2TB,分了两个区。 第二块磁盘为8TB,还未使用,剩下的是 虚拟磁盘的相关的信息。
格式化硬盘创建分区
使用 fdisk 命令
最初我使用了 fdisk 命令格式化硬盘: fdisk /dev/sdb
然后一系列的交互命令。n > p > 」> 」> 」 > w
。
[root@xxx~]# fdisk /dev/sdb 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 tableBuilding a new DOS disklabel with disk identifier 0x867a48ad.WARNING: The size of this disk is 8.0 TB (8000450330624 bytes).DOS partition table format can not be used on drives for volumeslarger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID partition table format (GPT).Command (m for help): nPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): pPartition number (1-4, default 1): First sector (2048-4294967295, default 2048): Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): Using default value 4294967294Partition 1 of type Linux and of size 2 TiB is setCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.
然后发现 这一个分区并没有使用全部磁盘空间。只有2TB。 然后才注意到fdisk 是 MBR 分区工具
他的提示里有如下信息
WARNING: The size of this disk is 8.0 TB (8000450330624 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).
使用 parted 命令
所以 改用 parted 重新分区。 parted /dev/sdb
, 依旧是交互模式。 mklabel gpt > mkpart > primary > xfs > 0 > -1
[root@xxx~]# parted /dev/sdbGNU Parted 3.1Using /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) mklabel GPTWarning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?Yes/No? yes (parted) p Model: LSI MR9361-8i (scsi)Disk /dev/sdb: 8000GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number Start End Size File system Name Flags(parted) mkpart Partition name? []? primary File system type? [ext2]? xfs Start? Start? 0 End? -1 Warning: The resulting partition is not properly aligned for best performance.Ignore/Cancel? Ignore (parted) p Model: LSI MR9361-8i (scsi)Disk /dev/sdb: 8000GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number Start End Size File system Name Flags 1 17.4kB 8000GB 8000GB primary
其中 创建分区表时 提示会丢失数据,需要输入 yes 确认, 以及分区时 提示未对齐, 选择 ignore 忽略。
在交互模式中 p /print 会输出硬盘的信息。
格式化文件系统以及挂载。
格式化文件系统
mkfs.xfs /dev/sdb1
挂载
mount /dev/sdb1 /mnt/
- linux 硬盘格式化工具 的使用
- LINUX使用未格式化的硬盘
- linux 大硬盘格式化挂载使用
- linux硬盘 格式化 分区
- Linux 硬盘,格式化,分区。
- Linux 硬盘,格式化,分区
- 【Linux】硬盘格式化--mkfs
- Linux格式化硬盘
- ubuntu下使用 Parted GPT工具对大于3T的硬盘进行分区,并使用mkfs进行格式化
- 硬盘的格式化
- Linux中怎样格式化硬盘
- Linux格式化硬盘 常用命令小记
- Linux格式化硬盘 常用命令小记
- linux添加硬盘并且格式化
- Linux格式化硬盘 常用命令小记
- Linux格式化硬盘 常用命令小记
- linux下分区、格式化、挂载新硬盘的详细过程
- linux下分区、格式化、挂载新硬盘的详细过程
- python学习二(字符,计算)
- linux 下使用 tc 模拟网络延迟和丢包
- 继续深究支持向量机---超详细讲解(比三层理解SVM好)
- MQTT libmosquitto源码分析
- 基于i.MX6UL的wifi音响设计
- linux 硬盘格式化工具 的使用
- 重建二叉树
- 端口转发:nginx做后端,Apache做前端
- 微信小程序表单验证错误提示
- 欢迎使用CSDN-markdown编辑器
- Android动画(二)之帧动画(DrawableAnimation)
- C++ 生疏英文术语翻译整理
- 一个程序员对另一个准程序员的忠告
- android 使用广播监听网络状态