公司有台服务器做了raid1,由于容量小,需扩容,原先打算再添加两块硬盘进去做多一组raid1,组成两组raid1混合使用,但是公司抠门,买到服务器只能安装3块硬盘,无奈之下只能放多一块进去单独挂载分区使用。

开始的时候把新加的硬盘接入raid卡,服务器开机无法识别,解决方法是把新加的硬盘接入主板的SATA接口,服务器开机登录后顺利识别到。

先说说开始时候的操作方法:

首先用fdisk进行分区

# fdisk /dev/sdb

整块硬盘全部空间只建立一个分区,分完区后查看

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x0005f698

Device Boot  Start  End    Blocks    Id  System
/dev/sdb1      1    121601   976760001   83     Linux

可以看到建立了一个新分区/dev/sdb1

然后进行格式化并挂载分区

# mkfs -t ext4 -c /dev/sdb1   (快速格式化:mkfs.ext4 /dev/sdb1)
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61054976 inodes, 244190000 blocks
12209500 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
7453 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848

Checking for bad blocks (read-only test): done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

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

# mount /dev/sdb1  /data

# df -h

可以看到已经成功挂载了

修改/etc/fstab,添加下面这行,使之开机自动挂载

/dev/sdb1               /data                   ext4    defaults        0 0

保存后重启服务器init 6

执行df -h发现竟然没有挂载成功

执行fdisk -l还能看到/dev/sdb1分区

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x0005f698

Device Boot  Start  End    Blocks    Id  System
/dev/sdb1      1    121601   976760001   83     Linux

但是没有存在/dev/sdb1

# ll /dev/sdb1

ls: cannot access /dev/sdb1: No such file or directory

重新执行挂载

# mount /dev/sdb1 /data/

mount: you must specify the filesystem type

加上分区类型重新挂载,提示不存在分区

# mount -t ext4 /dev/sdb1 /data/
mount: special device /dev/sdb1 does not exist

按照网上大神的方法,成功解决:

# 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=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61054976 inodes, 244190646 blocks
12209532 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
7453 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848

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

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

格式化整块硬盘

格式化完毕后fdisk -l查看

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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: 0x00000000

没有了/dev/sdb1分区

重新挂载

# mount /dev/sdb /data/

# df -h

成功挂载,修改/etc/fstab使之开机自动挂载,添加以下内容

/dev/sdb                /data                   ext4    defaults        0 0

init 6重启后发现能正常自动挂载,到此已成功解决问题

用lsblk命令查看已识别的硬盘和挂载的分区

# lsblk

linux中挂载硬盘报错(you must specify the filesystem type)的更多相关文章

  1. Linux mount挂载磁盘报错 mount: wrong fs type, bad option, bad superblock on /dev/vdb

    Linux mount挂载磁盘报错  mount: wrong fs type, bad option, bad superblock on /dev/vdb Linux挂载磁盘报如下错误: moun ...

  2. linux中启动网卡报错:Bringing up interface eth1: Error: Connection activation failed

    在重启linux网络服务的时候提示: Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2 并且产生报错 ...

  3. 64位linux中使用inet_ntoa报错处理

    最近一直使用linux mint 15,我用的是64位操作系统,在进行网络编程的时候,发现一个问题,请看源码: /*get_ip_by_name.c*/ #include <stdio.h> ...

  4. 为什么win记事本编辑的shell在linux中运行会报错

    结论:win记事本使用的格式有别于linux,二者不可混用.linux使用一个叫vi的编辑器. 解决办法:使用vi命令建立文件,在其中敲shell.命令:vi  > filename   (敲完 ...

  5. Linux中新增硬盘的分区,格式化与挂载

    Linux中新增硬盘的分区,格式化与挂载 本篇教程内容为怎样对Linux新增硬盘进行挂载,所以如果有准备新增硬盘但是有各种问题的,请参看本篇教程. 我们先说说什么是挂载? 我们知道Linux中的所有设 ...

  6. linux 下 tomcat 运行报错 Broken pipe

    linux 下 tomcat 运行报错 Broken pipe 感谢:http://hi.baidu.com/liupenglover/blog/item/4048c23ff19f1cd67d1e71 ...

  7. MAC OS 中mount nfs 报错问题.

    记一下 MAC OS 中mount nfs 报错问题. 环境和配置文件 NFS 服务端 Ubuntu 安装 apt install nfs-kernel-server 服务端的配置文件 cat /et ...

  8. pytest——pycharm中右击运行(run)没有问题,在terminal中运行pytest报错:E ModuleNotFoundError: No module named

    参考了这个解决办法:https://blog.csdn.net/qq_36829091/article/details/82180866 我的是Windows,linux的和Windows的解决办法有 ...

  9. Linux下Electron loadURL报错 ERR_FAILED(-2) Not allowed to load local resource

    Linux下Electron loadURL报错 ERR_FAILED(-2) Not allowed to load local resource 背景 使用electron-vue的时候,窗体创建 ...

随机推荐

  1. BZOJ 1503 郁闷的出纳员

    Description OIER公司是一家大型专业化软件公司,有着数以万计的员工.作为一名出纳员,我的任务之一便是统计每位员工的工资.这本来是一份不错的工作,但是令人郁闷的是,我们的老板反复无常,经常 ...

  2. optimize performance

    http://www.cnblogs.com/fullhouse/archive/2012/01/05/2313105.html http://www.cnblogs.com/fullhouse/ar ...

  3. centos qt5,PyQt5 installation

    一.SIP http://www.riverbankcomputing.com/software/sip/download   二.Centos6.5 qt 安装 1,centos linux系统必须 ...

  4. 《深入Linux内核》 UNIX的一些故事

    Unix文件的类型1.普通文件2.目录3.符号链接4.面向块的设备文件5.面向字符的设备文件6.管道和命名管道7.套接字 点评:不明觉厉 打开文件进程只能访问“打开的”文件.为了打开一个文件,进程调用 ...

  5. (转载)Mysql使用Describe命令判断字段是否存在

    (转载)http://www.jz123.cn/plus/view.php?aid=39200 工作时需要取得MySQL中一个表的字段是否存在 于是就使用Describe命令来判断 mysql_con ...

  6. vector::erase returns incompatible iterator in debug build

    关于std::vector中erase的用法http://www.cplusplus.com/reference/vector/vector/erase/ #include <vector> ...

  7. bzoj 3158 千钧一发(最小割)

    3158: 千钧一发 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 767  Solved: 290[Submit][Status][Discuss] ...

  8. 深度优先搜索DFS

    使用递归(隐式地使用栈) 时间代价O(E+V) 输入:图G.起点start(int) 算法过程DFS(G, start) 1. 访问start节点,color[start]=visited 2.  p ...

  9. GitHub上传不了的解决 ssh: connect to host github.com port 22: Bad file number git did not exit cleanly (exit code 128)

    问题情况 本来一直用的是github的客户端,结果现在上传的时候出问题了,去网站上看,新项目已经创建,但是代码却怎么都上传不上去.于是只好用命令行的方式解决. Tortoisegit上是这样说的: g ...

  10. HDU 4800/zoj 3735 Josephina and RPG 2013 长沙现场赛J题

    第一年参加现场赛,比赛的时候就A了这一道,基本全场都A的签到题竟然A不出来,结果题目重现的时候1A,好受打击 ORZ..... 题目链接:http://acm.hdu.edu.cn/showprobl ...