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. Spring Cloud 入门教程(七): 熔断机制 -- 断路器

    对断路器模式不太清楚的话,可以参看另一篇博文:断路器(Curcuit Breaker)模式,下面直接介绍Spring Cloud的断路器如何使用. SpringCloud Netflix实现了断路器库 ...

  2. kettle表更新/插入更新

    更新: 1.1更新表: 目标表: 插入更新: 2.1匹配表: 目标表: 插入/更新转换 目标表

  3. centos7只rsync+inotify

    环境: 操作系统:centos7.4 192.168.1.238 客户端 192.168.1.239 服务端 环境准备: 1.安装以下安装包lrzsz是xshell上传下载的安装包,可以忽略. yum ...

  4. js字符串轉數組,數組轉字符串

    字符串轉數組:split(',') 數組轉字符串:join(‘,’) https://www.cnblogs.com/woodk/p/5714329.html

  5. LDOOP ADD_PRINT_TEXT多页项

    纯文本打印(ADD_PRINT_TEXT)项超过宽度且高度不够的情况下,不会隐藏后面的内容,而是会分到下一页.分页数量和每页显示内容多少 和设置的纯文本打印项高度有关.LODOP.SET_PRINT_ ...

  6. [BZOJ 2242] [SDOI 2011] 计算器

    Description 你被要求设计一个计算器完成以下三项任务: 给定 \(y,z,p\),计算 \(y^z \bmod p\) 的值: 给定 \(y,z,p\),计算满足 \(xy≡ z \pmod ...

  7. HBase轻松入门之HBase架构图解析

    2018-12-13 2018-12-20 本篇文章旨在针对初学者以我本人现阶段所掌握的知识就HBase的架构图中各模块作一个概念科普.不对文章内容的“绝对.完全正确性”负责. 1.开胃小菜 关于HB ...

  8. Magento 架构基础知识概述

    Megento 架构基础知识概述 Magento整合了面向对象的基于PHP的应用程序的核心架构原则.这些一般原则的综合讨论既有在线的,也有印刷形式.以下讨论主要关注这些主题如何直接应用于Magento ...

  9. 牛客网 223C 区区区间间间(单调栈)

    题目链接:区区区间间间 题意:给出长度为n的数字序列ai,定义区间(l,r)的价值为, 请你计算出. 题解:单调栈求ai左边和右边第一个比它小的位置,需要减去ai的个数为$(R_i-i+1)*(i-L ...

  10. (二叉树 DFS 递归) leetcode 112. Path Sum

    Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all ...