1. 添加磁盘,查看磁盘状况

[root@db1 /]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *         151        1305     9277537+  83  Linux

/dev/sda2               1         150     1204843+  82  Linux swap

Partition table entries are not in disk order

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

从查询结果看出,多了一个/dev/sdb的盘

2. 用fdisk 对/dev/sdb 进行分区

[root@db1 /]# fdisk /dev/sdb

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-652, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):

Using default value 652

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

再次查看分区情况,多出来一个/dev/sdb1 的区,这个1是我们在前面指定的,如果我们指定2,就变成 sdb2了。

[root@db1 /]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *         151        1305     9277537+  83  Linux

/dev/sda2               1         150     1204843+  82  Linux swap

Partition table entries are not in disk order

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1         652     5237158+  83  Linux

[root@db1 /]#

如果创建完之后,/proc/partitions 查看不到对应的分区,使用parprobe 命令刷新一下就可以了:

[root@web1 ~]# cat /proc/partitions 
major minor  #blocks  name

8     0  175825944 sda
   8     1    1020096 sda1
   8     2   30716280 sda2
   8     3    8193150 sda3
[root@web1 ~]# partprobe /dev/sda
[root@web1 ~]# cat /proc/partitions 
major minor  #blocks  name

8     0  175825944 sda
   8     1    1020096 sda1
   8     2   30716280 sda2
   8     3    8193150 sda3
   8     4  135893835 sda4
[root@web1 ~]#

3. 格式化 /dev/sdb1 分区

[root@db1 /]# mkfs -t ext3 /dev/sdb1

mke2fs 1.35 (28-Feb-2004)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

655360 inodes, 1309289 blocks

65464 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=1342177280

40 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done

Creating journal (8192 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

4. 创建目录 并将 /dev/sdb1 挂在到该目录下

[root@db1 /]# ls

backup  dev   initrd      media  opt   sbin     sys       usr

bin     etc   lib         misc   proc  selinux  tftpboot  var

boot    home  lost+found  mnt    root  srv      tmp

[root@db1 /]# mkdir /u01

[root@db1 /]# ls

backup  dev   initrd      media  opt   sbin     sys       u01

bin     etc   lib         misc   proc  selinux  tftpboot  usr

boot    home  lost+found  mnt    root  srv      tmp       var

[root@db1 /]# mount /dev/sdb1 /u01

5. 验证挂载是否成功

[root@db1 /]# df -k

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/sda1              9131772   7066884   1601012  82% /

none                    454256         0    454256   0% /dev/shm

/dev/sdb1              5154852     43040   4849956   1% /backup

6. 设置开机自动挂载

[root@db1 /]# vi /etc/fstab

# This file is edited by fstab-sync - see 'man fstab-sync' for details

LABEL=/                 /                       ext3    defaults        1 1

none                    /dev/pts                devpts  gid=5,mode=620  0 0

none                    /dev/shm                tmpfs   defaults        0 0

none                    /proc                   proc    defaults        0 0

none                    /sys                    sysfs   defaults        0 0

LABEL=SWAP-sda2         swap                    swap    defaults        0 0

/dev/sdb1               /u01                 ext3    defaults        0 0

/dev/hdc                /media/cdrom            auto    pamconsole,exec,noauto,m

anaged 0 0

/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,m

anaged 0 0

Linux 下挂载硬盘的 方法的更多相关文章

  1. linux下挂载硬盘,解决阿里云挂载后重启消失的问题

    完整的阿里云挂载数据盘方法如下: 1.入手阿里云后查看有几块硬盘:(只显示概况,不显示分区情况) fdisk -l|grep Disk 2.查看硬盘分区 fdisk -l 如果有提示:disk /de ...

  2. Linux 自动挂载硬盘的方法

    每次重启后,都需要手动挂载硬盘( sudo mount ),非常不方便,使用一下步骤可以实现硬盘的自动挂载 第一步  获取硬盘的基本信息(UUID TYPE) sudo blkid 第二步  修改 / ...

  3. Linux下挂载硬盘分区的几种方法

    1.使用Autofs自动挂载分区 2.修改/etc/fstab 3.编写shell脚本,开机自动运行mount命令  方法一.使用Autofs  1.Autofs的特点:Autofs与Mount/Um ...

  4. linux下挂载硬盘出错的解决方法

    我的电脑是 Uuntu16.04 + win10 双系统,今天在Ubuntu中打开D盘时报错 Error mounting /dev/sda5 原因是D盘的格式是ntfs,在linux中会出现不识别的 ...

  5. 虚拟机Linux下扩展硬盘的方法

    [原文链接]:http://blog.csdn.net/tianlesoftware/article/details/5642883 装虚拟机时空间划小了,于是又加了5G的空间,折腾了半天,挂上去了. ...

  6. linux下挂载U盘方法

    1.使用 cat /proc/partitions 查看系统现在有哪些分区:[root@localhost ~]# cat /proc/partitions major minor  #blocks  ...

  7. Linux下挂载NTFS格式的U盘或硬盘

    我们知道在Linux下挂载fat32的U盘非常容易,使用mount /dev/drive_name /mnt/指定目录这样就可以挂载了,但是如果U盘或者硬盘的格式是NTFS的话,那么Linux是不能识 ...

  8. VMware,win7与linux centos6.4文件互传,linux下挂载windows共享文件夹,vmware tools安装方法

    本方法是以win7,VMware9.0.1 ,centos6.4为基础实验的. 对于linux的初级使用阶段,都会Windows中使用linux虚拟机VMWare或者其它的.在Windows与linu ...

  9. linux 手动挂载硬盘没有移到回收站解决方法

    linux 手动挂载硬盘没有移到回收站解决方法 修改挂载硬盘的文件夹权限为当前用户即可 或者 修改读写权限 chmod 777 mount-disk-path

随机推荐

  1. CSS制作hover下划线动画

    .demo1{ position: relative; text-decoration: none; font-size: 20px; color: #333; } .demo1:before{ co ...

  2. Exercise DS

    #include <iostream> using namespace std; typedef struct Node { Node *next; int data; }Node, *L ...

  3. 中文翻译:pjsip教程(三)之ICE stream transport的使用

    1:pjsip教程(一)之PJNATH简介 2:pjsip教程(二)之ICE穿越打洞:Interactive Connectivity Establishment简介 3:pjsip教程(三)之ICE ...

  4. yii2源码学习笔记(十六)

    Module类的最后代码 /** * Registers sub-modules in the current module. * 注册子模块到当前模块 * Each sub-module shoul ...

  5. 存储过程修改产品描述页图片alt描述信息

    今天修改了所有产品的图片信息,用到了存储过程.在参考下面存储过程以后,终于搞定了. 1 BEGIN 2 DECLARE Done INT DEFAULT 0; 3 4 DECLARE CurrentL ...

  6. ubuntu14.04下 Android虚拟机 genymotion 的下载和安装

    官网:https://www.genymotion.com/ Install Guide https://www.genymotion.com/#!/developers/user-guide#ins ...

  7. 百度地图 - demo

    项目需要集成百度地图,那么关于如何集成百度地图的事,就自己去百度开放平台查看文档吧,这是非常简单的事,在这里就不多说了. 那么下面我就说说我在这个demo里所做的事. 首先,项目需要具备定位及计算两地 ...

  8. JQUERY 插件开发——LAZYLOADIMG(预加载和延迟加载图片)

    开发背景 本插件开发是近期写的最后一个插件了,接下来我想把最近研究的redis最为一个系列阐述下.当然Jquery插件开发是我个人爱好,我不会停止,在将来的开发中我会继续完善,当然也会坚持写这个系列的 ...

  9. Early 80386 CPUs

    Assembling a detailed and accurate history of the 80386, including a complete listing of all the &qu ...

  10. LA 3904

    一道DP题: 一共有三种砖,1*2,2*1,2*2,然后要你铺满整个n*2的地板,求不重复的铺法数: 方法: 首先计算了不考虑对称的情况,然后计算只考虑对称的情况: 所以结果就是(不考虑对称数+只考虑 ...