1 查看哪些硬盘没有挂载

# fdisk -l

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

2 将新硬盘分区

# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd5cf1096.

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): p

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xd5cf1096

Device Boot Start End Blocks Id System
/dev/vdb1 2048 209715199 104856576 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

3 指定分区的文件系统格式

ext2

# mke2fs /dev/sda1

ext3

# mke2fs -j /dev/sda1

ext4

# mke2fs -t ext4 /dev/sda1

3.1 查看各个分区的文件系统格式

# parted -l
# file -s /dev/sda1
# df -T

4 挂载分区到目录

# mkdir /test
# mount /dev/sda1 /test

4.1 永久挂载

# vi /etc/fstab

/dev/sda1 /test ext4 defaults 1 1

5 查看目录以及分区

# df -h

【原创】Linux基础之挂载硬盘的更多相关文章

  1. Linux基础二(挂载、关机重启与系统等级)

    一.Linux 基础之挂载 1. 挂载和查询 1.1 挂载 什么叫挂载?装系统的时候要给硬盘分区,在 Windows 中要分 C 盘 D 盘 DEF 盘,这个操作我们叫做分配盘符,分配盘符之后我们就可 ...

  2. 阿里云Linux服务器,挂载硬盘并将系统盘数据迁移到数据盘

    因为之前用宝塔上线,宝塔只挂载了系统盘50G,打开阿里云云盘列表发现系统盘无法直接升级,故另买一块数据盘挂载到Linux服务器下,下面根据网上教程再结合我实际情况讲解一下实际操作,其实非常easy l ...

  3. linux --开机自动挂载硬盘【转】

    转:http://c.biancheng.net/view/900.html 了解了 mount 命令之后,读者可能会问,系统如何在开机时自动挂载硬盘,它又是怎么知道哪些分区是需要挂载的呢? 很简单, ...

  4. Linux分区和挂载硬盘

    分区: [root@code-svn ~]# fdisk /dev/sdb WARNING: DOS-compatible mode is deprecated. It's strongly reco ...

  5. Linux之批量挂载硬盘

    ############parted工具分区############### #!/bin/bash #shell脚本开头格式PATH=/bin:/sbin:/usr/bin:/usr/sbin #保证 ...

  6. linux基础——文件挂载,lamp安装

    一. 文件挂载 lsblk -f 显示文件系统信息 mount -t vfat UUID="ffffffffff" /mnt   挂载到/mnt目录 Linux针对于各式U盘挂载方 ...

  7. 【linux基础】查看硬盘位置信息

    nvidia@tegra-ubuntu:/media/nvidia/Elements/data$

  8. linux基础part3

    linux基础 一.linux基本命令归档命令. 1.归档的定义:归档就是把许多文件或目录打包成一个文件. 2.tar命令格式:tar  [参数-cxtzjvfpPN]  打包文件名 文件或目录路径 ...

  9. Linux基础三(软件安装管理)

    目录: 一.Linux 中软件包的分类 1.源码包 2.二进制包 3.源码包 4.软件安装的选择 二.软件安装之 RPM 1.背景知识 2.准备知识 3.安装升级与卸载 4.查询校验与提取 三.软件安 ...

随机推荐

  1. 【原创】讲讲亿级PV的负载均衡架构

    引言 本来没想写这个题材的,为了某某童鞋能够更好的茁壮成长,临时写一篇负载均衡的.负载均衡,大家可能听过什么3层负载均衡.4层负载均衡.7层负载均衡什么的?那这是怎么分的呢,ok,是根据osi七层网络 ...

  2. mybatis源码分析(五)------------SQL的执行过程

    在对SQL的执行过程进行分析前,先看下测试demo: /** * @author chenyk * @date 2018年8月20日 */ public class GoodsDaoTest { pr ...

  3. vertical-align和text-align属性实现垂直水平居中

    HTML: <div class="box"> <div class="content"> <span class="s ...

  4. Linux下C语言生成可执行文件的过程

    在当前目录下创建一个C源文件并打开: touch test.c gedit test.c直接编译: gcc test.c -o test 分步骤编译: 1) 预处理    gcc -E test.c  ...

  5. AutoMapper入门使用

    AutoMapper入门使用 在应用开发的过程中,首先要了解整个系统中各个系统的组件的作用,然后了解系统的工作流(workflow),最后需要梳理一遍数据流(dataflow),而在整理数据流的过程中 ...

  6. ICPC中国南昌国家邀请赛和国际丝绸之路规划大赛预选赛 I J

    I. Max answer 链接:https://nanti.jisuanke.com/t/38228 思路: 枚举最小值,单调栈确定最小值的边界,用线段树+前缀和维护最小值的左右区间 实现代码: # ...

  7. 【BZOJ5503】[GXOI/GZOI2019]宝牌一大堆(动态规划)

    [BZOJ5503][GXOI/GZOI2019]宝牌一大堆(动态规划) 题面 BZOJ 洛谷 题解 首先特殊牌型直接特判. 然后剩下的部分可以直接\(dp\),直接把所有可以存的全部带进去大力\(d ...

  8. shell 基础(一)

    废话少说 往下看 1. 查看 Shell Shell 是一个程序,一般都是放在/bin或者/user/bin目录下,当前 Linux 系统可用的 Shell 都记录在/etc/shells文件中./e ...

  9. 初识 go 语言

    目录 go简介 安装 hello world 函数 变量 常量 可见性规则 结束 前言: 最近组内要试水区块链,初步方案定为使用fabirc来弄,而fabric的智能合约就是用go写的,借此机会正好学 ...

  10. 联想的笔记本有隐藏分区 导致无法安装win10 eufi启动 报错:windows无法更新计算机的启动配置。无法安装

    联想的笔记本都带着类似一键还原等的系统恢复软件,这些软件往往是将出厂设置备份在单 独的一个分区,此分区默认为隐藏,在 Windows 的磁盘管理中可以看到.打开磁盘管理器 的方法是右击计算机——管理, ...