centos7硬盘挂载mysql_centos7 挂载新磁盘

一 、挂载新磁盘

查看磁盘

[root@localhost ~]# fdisk -l

Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000c81ed

Device Boot Start End Blocks Id System

/dev/vda1 * 2048 104857566 52427759+ 83 Linux

Disk /dev/vdb: 2199.0 GB, 2199023255552 bytes, 4294967296 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

磁盘/dev/vdb尚有2199GB未分配

查看分区

[root@localhost ~]# df -Th

Filesystem Type Size Used Avail Use% Mounted on

devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev

tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm

tmpfs tmpfs 7.8G 488K 7.8G 1% /run

tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup

/dev/vda1 ext4 50G 2.0G 45G 5% /

tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0

磁盘/dev/vdb实际并没有挂载

磁盘分区

注意:

# 执行"fdisk /dev/vdb"后,出现"Command (m for help)"提示时,依次输入下面指令

n -> p -> 1 -> 回车 -> 回车 -> w

详情:

[root@localhost ~]# fdisk /dev/vdb

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 0x11e106cf.

WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).

DOS partition table format can not be used on drives for volumes

larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID

partition table format (GPT).

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-4294967295, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-4294967294, default 4294967294):

Using default value 4294967294

Partition 1 of type Linux and of size 2 TiB is set

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

说明:

n:添加新分区

p:设为主分区

1: 分区序号

两个回车指是开始和结束的磁盘大小;

w:写入磁盘

格式分区

[root@localhost ~]# mkfs.ext4 /dev/vdb1

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

134217728 inodes, 536870655 blocks

26843532 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2684354560

16384 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, 512000000

Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

挂载磁盘

mkdir /mnt

mount /dev/vdb1 /mnt

确认磁盘

[root@localhost ~]# fdisk -l

Disk /dev/vda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000c81ed

Device Boot Start End Blocks Id System

/dev/vda1 * 2048 104857566 52427759+ 83 Linux

Disk /dev/vdb: 2199.0 GB, 2199023255552 bytes, 4294967296 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: 0x11e106cf

Device Boot Start End Blocks Id System

/dev/vdb1 2048 4294967294 2147482623+ 83 Linux

确认分区

[root@localhost ~]# df -Th

Filesystem Type Size Used Avail Use% Mounted on

devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev

tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm

tmpfs tmpfs 7.8G 492K 7.8G 1% /run

tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup

/dev/vda1 ext4 50G 2.0G 45G 5% /

tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0

/dev/vdb1 ext4 2.0T 81M 1.9T 1% /mnt

开机启动

echo "/dev/vdb1 /mnt ext4 defaults 0 0" >> /etc/fstab

二 、挂载旧目录

如果你要用来挂载的目录里面并不是空的,那么挂载了文件系统之后,原目录下的东西就会暂时的消失。并不是被覆盖掉,而是暂时的隐藏了起来,等到新分割槽被卸除之后,则原目录原本的内容就会再次出来。

如果要永久挂载已有目录,可以在新硬盘创建文件系统后,先挂载到一个临时目录,然后把要扩展的目录复制到这临时目录,然后删除要扩展的目录,再卸载临时挂载点,重新挂载到要扩展的目录上。举例:

# 比如要扩充 /var

# 在创建好文件系统后 新建临时挂载点 mnt

mkdir /mnt

# 将/dev/sdb1挂载到/mnt下

mount /dev/vdb1 /mnt

# 拷贝/var下的所有内容到新的硬盘

cp -pdr /var/* /mnt

# 删除当前/var目录下的内容

rm -rf /var/*

# 卸载磁盘

umount /dev/vdb1

# 重新挂载磁盘到/var目录

mount /dev/vdb1 /var

# 过程中若提示磁盘忙,使用fuser找出将正在使用磁盘的程序并结束掉;

fuser -m -v /var

fuser -m -v -i -k /var

# 开机启动

echo "/dev/vdb1 /var ext4 defaults 0 0" >> /etc/fstab

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/421513.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

autolisp 列表 resbuf

有以下 list : (1 2 3 (4 5 6) "Properties" (("id" . 3) ("name" . "hello lisp"))) 要求用: quote cons acutBuildList acutNewRb 方式构造 转载于:https://www.cnblogs.com/pangblog/p/3331246.html

如何看懂php源程序,概述 · thinkphp5.0 源码阅读学习 · 看云

**1 章节简介**概述: 记录框架的文件,类,函数或方法等索引到文章的具体章节,方便查找。框架流程:框架流程的重要文件分析。框架工具:框架自带的重要工具文件分析。框架驱动:框架底层的驱动与扩展目录分析。…

php评论盖楼怎么实现,dedecms评论盖楼实现楼层数,类似腾讯、网易的评论(5.5/5.6版)...

DEDE评论效果:修改后的效果:修改步骤一、织梦dedecms5.5版本(5.6版本请往下看)1、修改/plus/feedback_ajax.php文件的第131行(如果你没改过)下面是修改之前的代码:$qmsg {quote}{title}.$row[username]. 的原帖:{/title}{content…

Nokia 920全部CODE

code码都是7位,我是从别的地方copy过来的,code码后面带了些乱码懒得删了,自己数7位code就是了。 RM-820 NDT AMERICA ATT White 059N5T3RM-820 NDT AMERICA ATT Yellow 059N5T5RM-820 NDT AMERICA ATT Black 059L848RM-…

datagridview绑定与详细说明 (搜集)

1、实现一个用于处理数据库教程数据检索的详细信息的方法。 下面的代码示例实现一个 getdata 方法,该方法对一个 sqldataadapter 组件进行初始化,并使用该组件填充 datatable。 然后,将 datatable 绑定到 bindingsource 组件。请确保将 conne…

matlab显示二值直方图,图像灰度变换、二值化、直方图

1、灰度变换1)灰度图的线性变换Gnew Fa * Gold Fb。Fa为斜线的斜率,Fb为y轴上的截距。Fa>1 输出图像的对比度变大,否则变小。Fa1 Fb≠0时,图像的灰度上移或下移,效果为图像变亮或变暗。Fa-1,Fb255时,发…

Delphi XE2 之 FireMonkey 入门(13) - 动画(下)

TAnimation 类的主要成员: protectedfunction NormalizedTime: Single; //procedure ProcessAnimation; virtual; //其子类们主要通过覆盖此方法来实现不同的动画procedure Loaded; override; // publicprocedure Start; virtual; //播放procedure…

mysql 触发器 插入或者更新,MySQL 在触发器里中断记录的插入或更新?

下面是一种实现的方法。思路就是想办法在触发器中利用一个出错的语句来中断代码的执行。mysql> create table t_control(id int primary key);Query OK, 0 rows affected (0.11 sec)mysql> insert into t_control values (1);Query OK, 1 row affected (0.05 sec)mysql&g…

BZOJ 1601 [Usaco2008 Oct]灌水 (最小生成树)

题意 Farmer John已经决定把水灌到他的n(1<n<300)块农田&#xff0c;农田被数字1到n标记。把一块土地进行灌水有两种方法&#xff0c;从其他农田饮水&#xff0c;或者这块土地建造水库。 建造一个水库需要花费Wi(1<Wi<100000),连接两块土地需要花费Pij(1<pij<…

matlab mxarray array,[Matlab]MxArray与MwArray使用区别

引子在外部编程语言与matlab的交互中&#xff0c;Array是最单元的交互元素&#xff0c;怎么都绕不过去。在matlab提供的Array接口有两个&#xff0c;一个是C的MxArray, 另一个是Cpp(C)的MwArray.看下两着的分别介绍&#xff1a;mxArray&#xff1a;Matlab C 函数库的结构体mwAr…

NSARRAY的 内存管理

一个对象加入到nsarray里内存计数器会1,当这个nsarrayrelease的时候,回自动减1,程序员不需要管理这方面的内存.转载于:https://www.cnblogs.com/gm-lotus/p/3349509.html

blender怎么移动骨骼,Blender学习笔记-(015)创建骨骼绑定及权重绘制操作详解

骨骼创建绑定具体操作如下&#xff1a;1&#xff1a; 【ShiftA】创建基础骨骼。(也可以通过打开Blender的插件Rigging&#xff1a;Rigify&#xff0c;生成自定义骨骼)2&#xff1a;点击骨骼&#xff0c;按【Tab】键进入编辑模式&#xff0c;选中创建骨骼端&#xff0c;按【E】拖…

[MySQL binlog实战] 增量同步与数据搜索~从入门到精通

学习基础知识&#xff0c;并落实到实际场景&#xff08;增量同步数据搜索&#xff09; 对基础知识不感兴趣的&#xff0c;可以直接跳到应用场景 文章目录 binlog是什么简介产生方式文件格式statementrowmixed 怎么办开启 binlog查看 binlog其他查看相关命令运维查看 binlog设置…

从硬核科幻小说《三体》中看嵌入式

1 2 3 4 5 6 7 8 9 转载于:https://www.cnblogs.com/OleNet/p/3352189.html