centos7 disk mount

1. Display disk partition status

[jumproot@localhost /]$ fdisk -l

2. Partition

New partition

[jumproot@localhost /]$ fdisk /dev/sdc

Then select p, the partition type is primary partition

Write to partition table

Press Enter twice to default to all the remaining space, and finally enter w to write to the partition and exit. If you do not save and exit, enter q

3. Check the disk partition just now

[jumproot@localhost /]$ fdisk -l

[jumproot@localhost /]$ lsblk

4. Format

[jumproot@localhost /]$ mkfs.xfs /dev/sdb1

5. Mount: associate a partition with a directory

mount device name mount directory

For example: mount /dev/sdb1 /home/newdisk

Attachment: Unmount: umount device name or mount directory

      For example: umount /dev/sdb1 or umount /home/newdisk

6. Set up automatic mounting

Automatically mount by modifying /etc/fstab

After the addition is complete, execute mount -a to take effect

Automatically write on startup

[jumproot@localhost /]$ vim /etc/fstab

So far. Mounting of the new hard disk is complete

Guess you like

Origin blog.csdn.net/weixin_41086692/article/details/108099290