磁盘及文件系统管理应用实例
2023-09-27 14:23:07 时间
2.创建一个大小为1G的swap分区,并创建好文件系统,并启用之,写一个脚本
获取并列出当前系统上的所有磁盘设备
显示每个磁盘设备上每个分区的相关的空间使用信息
Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): +1G Partition 2 of type Linux and of size 1 GiB is set Command (m for help): t Partition number (1,2, default 2): 2 Hex code (type L to list all codes): L Hex code (type L to list all codes): 82 Changed type of partition Linux to Linux swap / Solaris Command (m for help): w The partition table has been altered! [root@master ~]# mkswap -L SWAP /dev/sdb2 [root@master ~]# swapon /dev/sdb2 #!/bin/bash disks=`fdisk -l|grep -o ^Disk /dev/[sh]d[a-z]|cut -d -f2` echo $disks for i in $disks;do fdisk -l $i done
3.总结RAID的各个级别及其组合方式和性能的不同
RAID(冗余磁盘阵列)是将多块磁盘当做一块物理磁盘来使用,以达到容错或者提高读写性能的优势。按照 组织起来的工作方式的不同,我们可以将RAID分为不同的级别,其中常见的有RAID0、RAID1、RAID5、RAID10
RAID0
俗称条带卷,实现将文件分成多个chunk后同时并行存储到多个盘中。
特性
读写性能得到提升
无冗余能力
最少磁盘数为2
可用空间为容量最小的磁盘*磁盘数
RAID1
俗称镜像卷,在存储数据的同时需要再复制一份存入另一个磁盘中。
特性
读性能提升,写性能下降
有冗余能力
最少磁盘数为2,偶数
可用空间小于1/2
RAID5
将文件分成多个chunk,两两chunk之间作异或运算,各盘轮流存储校验码
特点
读写性能提升
有冗余能力
最少磁盘数为3
可用空间为容量最小的磁盘*(磁盘数-1)
RAID10
先两两做raid1,后将多组raid1组织成raid0
特点
读写性能提升
有冗余能力
最小磁盘数4
可用空间为容量最小的磁盘*磁盘数/2
4.创建一个大小为10G的RAID1,要求有一个空闲盘,而且chunk大小为128k
[root@master ~]# fdisk /dev/sdb Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (20973568-41943039, default 20973568): Using default value 20973568 [root@master ~]# fdisk /dev/sdb 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-104857599, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +10G Partition 1 of type Linux and of size 10 GiB is set Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (20973568-104857599, default 20973568): +10G Value out of range. First sector (20973568-104857599, default 20973568): Using default value 20973568 Last sector, +sectors or +size{K,M,G} (20973568-104857599, default 104857599): +10G Partition 2 of type Linux and of size 10 GiB is set Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (3,4, default 3): 3 First sector (41945088-104857599, default 41945088): Using default value 41945088 Last sector, +sectors or +size{K,M,G} (41945088-104857599, default 104857599): +10G Partition 3 of type Linux and of size 10 GiB is set Command (m for help): t Partition number (1-3, default 3): 1 Hex code (type L to list all codes): fd Changed type of partition Linux to Linux raid autodetect Command (m for help): t Partition number (1-3, default 3): 2 Hex code (type L to list all codes): fd Changed type of partition Linux to Linux raid autodetect Command (m for help): t Partition number (1-3, default 3): 3 Hex code (type L to list all codes): fd Changed type of partition Linux to Linux raid autodetect Command (m for help): w The partition table has been altered! [root@master ~]# mdadm -C /dev/md0 -n 2 -c 128 -x 1 -l 1 -a yes /dev/sdb{1,2,3} mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started.
5.创建一个大小为4G的RAID5设备,chunk大小为256k,格式化ext4文件系统,要求可开机自动挂载至/backup目录,且不更新访问时间戳,且支持acl功
[root@master ~]# fdisk /dev/sdb Command (m for help): n All primary partitions are in use Adding logical partition 5 First sector (62918656-104857599, default 62918656): Using default value 62918656 Last sector, +sectors or +size{K,M,G} (62918656-104857599, default 104857599): +2G Partition 5 of type Linux and of size 2 GiB is set Command (m for help): n All primary partitions are in use Adding logical partition 6 First sector (67115008-104857599, default 67115008): Using default value 67115008 Last sector, +sectors or +size{K,M,G} (67115008-104857599, default 104857599): +2G Partition 6 of type Linux and of size 2 GiB is set Command (m for help): n All primary partitions are in use Adding logical partition 7 First sector (71311360-104857599, default 71311360): Using default value 71311360 Last sector, +sectors or +size{K,M,G} (71311360-104857599, default 104857599): +2G Partition 7 of type Linux and of size 2 GiB is set Command (m for help): w The partition table has been altered! [root@master ~]# mdadm -C /dev/md1 -n 3 -c 256 -l 5 -a yes /dev/sdb{5,6,7} mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md1 started. [root@master ~]# mke2fs -t ext4 /dev/md1 [root@master ~]# mkdir /backup [root@master ~]# mount -o auto /dev/md1 /backup
11.2 磁盘配额启动前的准备工作 前面我们已经谈到,使用磁盘配额的前提,是必须要内核以及文件系统支持才行,这里假设大家使用的就是支持磁盘配额的内核,那么接下来就是要配置文件系统,使其支持配额限制。
Linux - 挂载磁盘 + 通过LVM动态实现磁盘的动态扩容 Linux - 挂载磁盘 + 通过LVM动态实现磁盘的动态扩容1 LVM是什么1.1 概念解释LVM(Logical Volume Manager), 逻辑卷管理, 是一种将一至多个硬盘的分区在逻辑上进行组合, 当成一个大硬盘来使用.
相关文章
- 达梦删除数据库实例(非软件)
- HTML+CSS实例——漂亮的背景(一)
- 大数据入门第九天——MapReduce详解(五)mapJoin、GroupingComparator与更多MR实例
- 微信支付现金红包接口应用实例代码说明和DEMO详解,适合用来做微信红包营销活动、吸粉利器
- ***PHP类型转换实例:$this->input->get()返回的结果是字符串类型(数字字符串转数字)
- python中的实例方法、静态方法、类方法、类变量和实例变量
- python子进程模块subprocess详解与应用实例 之三
- python子进程模块subprocess详解与应用实例 之二
- python子进程模块subprocess详解与应用实例 之一
- 实操手册:如何玩转跨库Join?跨数据库实例查询应用实践
- Mysql多实例安装+主从复制+读写分离 -学习笔记
- JSP自己定义标签入门实例具体解释
- Halcon实例转OpenCvSharp(C# OpenCV)实现--瓶口缺陷检测(附源码)
- C#图像处理-OpenCVSharp教程(六) OpenCVSharp实例应用:视频分解图片、图片合成视频、批量读取图片(有序/无序)
- mongodb多表查询(附带pymongo实例)
- iOS中 通知中心Text (实例)
- 数据库名和实例
- 一个简单而经典的RTX51 Tiny应用实例
- Oracle 实例名/服务名 请问SID和Service_Name有什么区别
- 如何使用python来模拟鼠标点击(将通过实例自动化模拟在360浏览器中自动搜索"python")
- [WCF安全系列]实例演示:TLS/SSL在WCF中的应用[HTTPS]
- C#winform中只允许程序运行一个实例
- 实例应用:自动答卷评分【MATLAB实现】
- sqlserver触发器详解:sqlserver触发器after/for和instead of的区别详解(实例讲解),触发器定义创建操作打通,触发器的优缺点,触发器使用建议
- React-navigation导航系统(4)-Redux的整合实例
- ReactNative (API)AsyncStorage存储详解及实例
- Oracle重建表空间操作实例
- Jackson优化使用实例
- linux下dd命令详解及应用实例