打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
CentOS7.6挂载硬盘

2. 查看新挂载好的硬盘

# 使用 fdisk -l 命令查看所有磁盘信息[root@gaia ~]# fdisk -lDisk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000b6389   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048     2099199     1048576   83  Linux/dev/sda2         2099200   104857599    51379200   8e  Linux LVMDisk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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: 48.4 GB, 48444211200 bytes, 94617600 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: 4160 MB, 4160749568 bytes, 8126464 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes# 显示/dev/sda 是正常使用的硬盘/dev/sdb 是新加上的硬盘

3. 分区

# 使用 fdisk /dev/sdb 命令对新的加入的硬盘进行分区[root@gaia ~]# 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 0x9bfd8348.Command (m for help): n		# 表示创建分区Partition type:   p   primary (0 primary, 0 extended, 4 free)   e   extendedSelect (default p): p		# 表示创建主分区Partition number (1-4, default 1): 1		# 表示创建1号分区First sector (2048-20971519, default 2048): 		# 表示起始分区,默认Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): 	# 表示结束分区,默认是全部容量Using default value 20971519Partition 1 of type Linux and of size 10 GiB is setCommand (m for help): w		# 表示写入分区,生效The partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.# 使用 fdisk -l 命令查看分区结果[root@gaia ~]# fdisk -lDisk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000b6389   Device Boot      Start         End      Blocks   Id  System/dev/sda1   *        2048     2099199     1048576   83  Linux/dev/sda2         2099200   104857599    51379200   8e  Linux LVMDisk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x9bfd8348   Device Boot      Start         End      Blocks   Id  System/dev/sdb1            2048    20971519    10484736   83  LinuxDisk /dev/mapper/centos-root: 48.4 GB, 48444211200 bytes, 94617600 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: 4160 MB, 4160749568 bytes, 8126464 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytes# 显示成功创建 /dev/sdb1

4. 格式化分区

# 使用 mkfs.xfs -f /dev/sdd1 命令进行格式化分区[root@gaia ~]# mkfs.xfs -f /dev/sdb1 meta-data=/dev/sdb1              isize=512    agcount=4, agsize=655296 blks         =                       sectsz=512   attr=2, projid32bit=1         =                       crc=1        finobt=0, sparse=0data     =                       bsize=4096   blocks=2621184, imaxpct=25         =                       sunit=0      swidth=0 blksnaming   =version 2              bsize=4096   ascii-ci=0 ftype=1log      =internal log           bsize=4096   blocks=2560, version=2         =                       sectsz=512   sunit=0 blks, lazy-count=1realtime =none                   extsz=4096   blocks=0, rtextents=0

5. 挂载

5.1 挂载临时分区

# 使用 mount -t xfs /dev/sdd1 /DATA 命令进行磁盘挂载。把新加入的磁盘分区挂载到/DATA目录下# 在根目录下创建文件夹”DATA“[root@gaia /]# mkdir DATA[root@gaia ~]# mount -t xfs /dev/sdb1 /DATA[root@gaia ~]# df -hFilesystem               Size  Used Avail Use% Mounted on/dev/mapper/centos-root   46G  1.5G   44G   4% /devtmpfs                 1.9G     0  1.9G   0% /devtmpfs                    1.9G     0  1.9G   0% /dev/shmtmpfs                    1.9G   12M  1.9G   1% /runtmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup/dev/sda1               1014M  146M  869M  15% /boottmpfs                    378M     0  378M   0% /run/user/0/dev/sdb1                 10G   33M   10G   1% /DATA

5.2 开启自动挂载分区

# 编辑 /etc/fstab 加入自动挂载语句[root@gaia ~]# vi /etc/fstab/dev/sdb1 /DATA                                 xfs     defaults        0 0
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
VMware Workstation 添加磁盘 挂载目录(centos)
linux 文件系统管理三部曲之一:磁盘分区
centos7下对原有磁盘分区进行在线扩容
centos7使用fdisk:创建和维护MBR分区表
Linux磁盘系统基础知识
Linux下磁盘挂载
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服