Linux mount掛載磁盤

安裝nfs

yum install nfs-utils

運行fdisk -l命令查看實例上的數據盤,發現/dev/vdb未被使用

[[email protected] ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00020f78

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           1        5222    41940992   83  Linux

Disk /dev/vdb: 64.4 GB, 64424509440 bytes
16 heads, 63 sectors/track, 124830 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x41398dd0

創建一個ext4文件系統

[[email protected] ~]# mkfs -t ext4 /dev/vdb1

運行mount /dev/vdb1 /mnt命令掛載文件系統

[[email protected] ~]# mount /dev/vdb1 /mnt

如果運行df -Th命令後出現新建文件系統的信息,表示文件系統掛載成功

[[email protected] ~]# df -Th
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/vda1      ext4    40G   35G  2.8G  93% /
tmpfs          tmpfs  3.9G     0  3.9G   0% /dev/shm
/dev/vdb1      ext4    59G   1G   58G  99% /mnt

設置自動掛載

[[email protected] ~]# lsblk -f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
vda                                                      
└─vda1 ext4         1ae5f12f-79c1-47d4-************* /
vdb                                                      
└─vdb1 ext4         1e3cb065-e1ad-4ee1-************* /mnt

通過修改/etc/fstab實現自動掛載,添加如下配置即可

echo 'UUID=1e3cb065-e1ad-4ee1-******* /mnt ext4 defaults 0 0' >> /etc/fstab

添加完成後,執行mount -a 即可生效

mount -a

mount: wrong fs type, bad option, bad superblock on /dev/vdb

Linux掛載磁盤報如下錯誤:

mount: wrong fs type, bad option, bad superblock on 192.168.0.68:/mnt,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

沒有格式化 , 按上面步驟格式化

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章