linux 硬盘格式化工具 的使用
2017-05-19 15:18
295 查看
linux 硬盘格式化工具 的使用
查看现在的磁盘使用状况
格式化硬盘创建分区
使用 fdisk 命令
使用 parted 命令
格式化文件系统以及挂载
格式化文件系统
挂载
因为使用了 LVM 所以 单独给
使用
可以看到 第一块磁盘大小为 1.2TB,分了两个区。 第二块磁盘为8TB,还未使用,剩下的是 虚拟磁盘的相关的信息。
然后发现 这一个分区并没有使用全部磁盘空间。只有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).
其中 创建分区表时 提示会丢失数据,需要输入 yes 确认, 以及分区时 提示未对齐, 选择 ignore 忽略。
在交互模式中 p /print 会输出硬盘的信息。
查看现在的磁盘使用状况
格式化硬盘创建分区
使用 fdisk 命令
使用 parted 命令
格式化文件系统以及挂载
格式化文件系统
挂载
linux 硬盘格式化工具 的使用
公司新到了两台服务器,系统都已经装好了,但有个RAID没有挂载使用,所以有了这篇文章。查看现在的磁盘使用状况
首先df -Th先查看一下现在的目录挂载情况,已经文件系统的类型。
[root@xxx ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 1.1T 16G 1.1T 2% / devtmpfs devtmpfs 32G 0 32G 0% /dev tmpfs tmpfs 32G 0 32G 0% /dev/shm tmpfs tmpfs 32G 9.1M 32G 1% /run tmpfs tmpfs 32G 0 32G 0% /sys/fs/cgroup /dev/sda1 xfs 197M 157M 41M 80% /boot tmpfs tmpfs 6.3G 0 6.3G 0% /run/user/0
因为使用了 LVM 所以 单独给
/boot分配了 200MB,主目录挂载的对象显示为
/dev/mapper/centos-root。而且文件系统为 xfs 。
使用
fdisk -l查看磁盘的使用情况。
[root@xxx~]# fdisk -l Disk /dev/sda: 1199.2 GB, 1199168290816 bytes, 2342125568 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: 0x00044d27 Device Boot Start End Blocks Id System /dev/sda1 * 2048 411647 204800 83 Linux /dev/sda2 411648 2342125567 1170856960 8e Linux LVM Disk /dev/sdb: 8000.5 GB, 8000450330624 bytes, 15625879552 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/centos-root: 1130.2 GB, 1130239098880 bytes, 2207498240 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/centos-swap: 68.7 GB, 68715282432 bytes, 134209536 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
可以看到 第一块磁盘大小为 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 table Building 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 volumes larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID partition table format (GPT). 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-4294967295, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294): Using default value 4294967294 Partition 1 of type Linux and of size 2 TiB is set Command (m for help): w The 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/sdb GNU Parted 3.1 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel GPT Warning: 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: 8000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk 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: 8000GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk 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 大硬盘格式化挂载使用
- ubuntu下使用 Parted GPT工具对大于3T的硬盘进行分区,并使用mkfs进行格式化
- LINUX使用未格式化的硬盘
- linux下使用fdisk工具快速挂载新硬盘
- Linux系统添加硬盘设备(磁盘分区-格式化-挂载-使用)
- linux下硬盘性能(网络盘)测试工具fio使用
- linux硬盘检测工具:Smartmontools使用指南(转)
- 怎么在Linux系统下使用NTFS的U盘或者是分区以及移动硬盘-使用工具NTFS-3G
- linux下使用fdisk工具快速挂载新硬盘
- Linux操作系统上如何使用QQ和MSN工具
- Linux下添加新硬盘及分区格式化要点
- 在linux 下使用 qq的新工具 pidgin
- gdb调试要点以及arm-linux交叉工具的使用
- 解除使用Linux分区工具时给大家带来的困扰
- linux高级工具命令(二)tcpdump的使用详解
- Linux下添加硬盘,分区,格式化
- 使用Grub进行Linux的硬盘安装与修复
- Linux 查看磁盘分区、文件系统、磁盘的使用情况相关的命令和工具介绍
- linux的工具集锦A-vi的使用