1. 程式人生 > >掛載磁盤出錯

掛載磁盤出錯

mount 掛載磁盤出錯

最近工作中遇到一個問題,在linux mount /dev/sdb 到 /mnt 分區時報錯:
[root@centos6 ~]# mount /dev/sdb /mnt/
mount: you must specify the filesystem type
報錯主要是因為沒有指定文件系統格式。

1、查看磁盤設備
[root@centos6 ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x0004cd37

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26          91      524288   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3              91        2611    20241408   83  Linux

Disk /dev/sdb: 105 MB, 105906176 bytes
64 heads, 32 sectors/track, 101 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2、先執行:mkfs.ext4 /dev/sdb
[root@centos6 ~]# mkfs.ext4 /dev/sdb
mke2fs 1.41.12 (17-May-2010)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
25896 inodes, 103424 blocks
5171 blocks (5.00%) reserved for the super user

First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
1992 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729

Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

3、再mount 即可:
mount -t ext4 /dev/sdb /mnt
[root@centos6 ~]# mount /dev/sdb /mnt

[root@centos6 ~]# df -h

4、查看掛載後狀態。
[root@centos6 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 19G 2.2G 16G 13% /
tmpfs tmpfs 238M 0 238M 0% /dev/shm
/dev/sda1 ext4 190M 40M 141M 22% /boot
/dev/sdb ext4 94M 1.6M 88M 2% /mnt

掛載磁盤出錯