CentOS mount hard disk
-
View currently unmounted hard disks
# fdisk -l
-
Create hard disk partitions
# fdisk /dev/sdb
根据提示,依次输入"n","p" "1",两次回车,"wq",分区就开始了,很快就会完成。
-
format the hard drive
# mkfs.ext4 /dev/sdb
-
Create a mount directory
# mkdir /data
-
mount hard disk
# mount /dev/sdb /data
-
Set up auto mount at startup
# vi /etc/fstab
在vi中输入i进入INERT模式,将光标移至文件结尾处并回车,将下面的内容复制/粘贴,然后按Esc键,输入":wq"(不含双引号)保存并退出 /dev/sdb /data ext4 defaults 0 0
-
restart the server
# shutdown -r now
linux(centos) save and exit vi editing method-----
save command Press ESC to jump to command mode, then: :w save the file without exiting vi :w file Save the changes to file separately without exiting vi :w! Force save, do not launch vi :wq save the file and exit vi :wq! Force save the file and exit vi q: quit vi without saving the file :q! Force quit vi without saving the file :e! Abandon all changes and start editing from the last time the file was saved