记一次创建LVM的日志记录
先上一张鸟哥LVM的图.感觉这张最清楚了.
#以下以Xshell的日志记录系统直接记录.上面添加了一些个人理解的注释
[BEGIN] 2016/9/13 9:22:24
#先查看下硬盘的情况.
[root@iZ23h637rtdZ ~]# fdisk -l Disk /dev/vda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078f9c Device Boot Start End Blocks Id System
/dev/vda1 * 1 7833 62912512 83 Linux Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System
/dev/vdb1 1 65270 524281243+ 8e Linux LVM
#上面这里显示已经有LVM.但是为了方便演示. 下面先将这个删除掉了
[root@iZ23h637rtdZ ~]# fdisk /dev/vdb WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u'). Command (m for help): p Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System
/dev/vdb1 1 65270 524281243+ 8e Linux LVM Command (m for help): d
Selected partition 1 Command (m for help): p Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270):
Using default value 65270 Command (m for help): p Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System
/dev/vdb1 1 65270 524281243+ 83 Linux
#此处使用t来修改格式.由于是需要LVM.所以需要改为8e的格式.
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): p Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System
/dev/vdb1 1 65270 524281243+ 8e Linux LVM Command (m for help): w
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
[root@iZ23h637rtdZ ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/vda (Device or resource busy).
As a result, it may not reflect all of your changes until after reboot.
[root@iZ23h637rtdZ ~]# fdisk -l Disk /dev/vda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078f9c Device Boot Start End Blocks Id System
/dev/vda1 * 1 7833 62912512 83 Linux Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System
/dev/vdb1 1 65270 524281243+ 8e Linux LVM
[root@iZ23h637rtdZ ~]# pvscan
No matching physical volumes found
#先建pv.后面接具体的划分的路径.
[root@iZ23h637rtdZ ~]# pvcreate /dev/vdb1
Physical volume "/dev/vdb1" successfully created
[root@iZ23h637rtdZ ~]# pvscan
PV /dev/vdb1 lvm2 [499.99 GiB]
Total: 1 [499.99 GiB] / in use: 0 [0 ] / in no VG: 1 [499.99 GiB]
[root@iZ23h637rtdZ ~]# pvdisplay
"/dev/vdb1" is a new physical volume of "499.99 GiB"
--- NEW Physical volume ---
PV Name /dev/vdb1
VG Name
PV Size 499.99 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID GOeBQF-iCCD-n7i7-Y4DT-U5PE-tjHK-B9Z3CL #再建VG.由于是直接使用整个划分的区块,所以直接跟区块名 /dev/vdb1,前面接的是vg名称,这个随便命名的.
[root@iZ23h637rtdZ ~]# vgcreate mailbox_vg /dev/vdb1
Volume group "mailbox_vg" successfully created
[root@iZ23h637rtdZ ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "mailbox_vg" using metadata type lvm2
[root@iZ23h637rtdZ ~]# pvscan
PV /dev/vdb1 VG mailbox_vg lvm2 [499.99 GiB / 499.99 GiB free]
Total: 1 [499.99 GiB] / in use: 1 [499.99 GiB] / in no VG: 0 [0 ]
[root@iZ23h637rtdZ ~]# vgdisplay
--- Volume group ---
VG Name mailbox_vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 499.99 GiB
PE Size 4.00 MiB
Total PE 127998
Alloc PE / Size 0 / 0
Free PE / Size 127998 / 499.99 GiB
VG UUID JjdDER-Y1OK-ICwZ-3FgC-cry2-bZYl-SqD3RP #下面需要创建LV.-l后面接的是pe的数量.这个可使用上面的vgdisplay的命令来查看.
#然后后面接lv的名称.也是可以随便命名,但是个人建议这里写个可以区分的.要不到时难分清楚.
[root@iZ23h637rtdZ ~]# lvcreate -l 127998 -n mailbox_lv mailbox_vg
Logical volume "mailbox_lv" created
[root@iZ23h637rtdZ ~]# lvdisplay
--- Logical volume ---
LV Path /dev/mailbox_vg/mailbox_lv
LV Name mailbox_lv
VG Name mailbox_vg
LV UUID VPA4HE-22B4-gZc0-Qo8V-TO1C-tKaF-AT8s5T
LV Write Access read/write
LV Creation host, time iZ23h637rtdZ, 2016-09-13 09:25:34 +0800
LV Status available
# open 0
LV Size 499.99 GiB
Current LE 127998
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0 [root@iZ23h637rtdZ ~]# fdisk -l Disk /dev/vda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00078f9c Device Boot Start End Blocks Id System
/dev/vda1 * 1 7833 62912512 83 Linux Disk /dev/vdb: 536.9 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3a7be7cb Device Boot Start End Blocks Id System
/dev/vdb1 1 65270 524281243+ 8e Linux LVM Disk /dev/mapper/mailbox_vg-mailbox_lv: 536.9 GB, 536862523392 bytes
255 heads, 63 sectors/track, 65269 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000 #建好了.进行格式化
[root@iZ23h637rtdZ ~]# mkfs -t ext4 /dev/mailbox_vg/mailbox_lv
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32768000 inodes, 131069952 blocks
6553497 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
4000 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 Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#创建挂载目录,进行挂载.
[root@iZ23h637rtdZ ~]# mkdir /mail_mailbox
[root@iZ23h637rtdZ ~]# mount /dev/
Display all 179 possibilities? (y or n)
[root@iZ23h637rtdZ ~]# mount /dev/mailbox_vg/mailbox_lv /mail_mailbox/
[root@iZ23h637rtdZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 59G 1.9G 55G 4% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/mapper/mailbox_vg-mailbox_lv
493G 70M 467G 1% /mail_mailbox
#使用vim修改fstab的文件.让其开机自动的挂载 .
以下是后面cat /etc/fstab的内容补上,这里vim没有记录
--------------------------------------------------------------------------------------
[root@iZ23h637rtdZ ~]# cat /etc/fstab #
# /etc/fstab
# Created by anaconda on Thu Aug 14 21:16:42 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=94e4e384-0ace-437f-bc96-057dd64f42ee / ext4 defaults,barrier=0 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/mailbox_vg/mailbox_lv /mail_mailbox ext4 defaults 1 2
[root@iZ23h637rtdZ ~]#
--------------------------------------------------------------------------------------
[root@iZ23h637rtdZ ~]# vim /etc/fstab
#下面进行umount然后再mount -a测试一下fstab是否正常写
[root@iZ23h637rtdZ ~]# umount /mail_mailbox/
[root@iZ23h637rtdZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 59G 1.9G 55G 4% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
[root@iZ23h637rtdZ ~]# mount -a
[root@iZ23h637rtdZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 59G 1.9G 55G 4% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/mapper/mailbox_vg-mailbox_lv
493G 70M 467G 1% /mail_mailbox [END] 2016/9/13 9:32:31
这里到此就结束的.整合一下相关的一些步骤:
#fdisk /dev/vdb
#pvcreate /dev/vdb1
#vgcreate mailbox_vg /dev/vdb1
#lvcreate -l 127998 -n mailbox_lv mailbox_vg
#mkfs -t ext4 /dev/mailbox_vg/mailbox_lv
#mkdir /mail_mailbox
#mount /dev/mailbox_vg/mailbox_lv /mail_mailbox/
记一次创建LVM的日志记录的更多相关文章
- OneAPM大讲堂 | Java 异常日志记录最佳实践
[编者按]本文作者是 Casey Dunham.Casey 是一位具有 10 多年经验的专业软件开发人员,以其独特的方式应对应用安全问题而闻名.本文系国内 ITOM 管理平台 OneAPM 工程师编译 ...
- 【转】使用Log4Net进行日志记录
首先说说为什么要进行日志记录.在一个完整的程序系统里面,日志系统是一个非常重要的功能组成部分.它可以记录下系统所产生的所有行为,并按照某种规范表达出来.我们可以使用日志系统所记录的信息为系统进行排错, ...
- 基于.NetCore3.1系列 —— 日志记录之自定义日志组件
一.前言 回顾:日志记录之日志核心要素揭秘 在上一篇中,我们通过学习了解在.net core 中内置的日志记录中的几大核心要素,在日志工厂记录器(ILoggerFactory)中实现将日志记录提供器( ...
- 如何定制.NET6.0的日志记录
在本章中,也就是整个系列的第一部分将介绍如何定制日志记录.默认日志记录仅写入控制台或调试窗口,这在大多数情况下都很好,但有时需要写入到文件或数据库,或者,您可能希望扩展日志记录的其他信息.在这些情况下 ...
- wpf 全局异常捕捉+错误日志记录+自动创建桌面图标
/// /// 创建桌面图标 /// public static void CreateShortcutOnDesktop(string LnkName) { String shortcutPath ...
- 记一次基于springboot+aop实现日志记录实战
1. 为什么要记录日志 好处: a. 可以对一些重要功能进行记录,方便以后跟踪是谁操作此功能的. b. 在操作某些功能时可能会发生异常,但每次出现异常我们想定位日志都要去服务器查看我们的日志.有了日志 ...
- 记录 shell学习过程(1) 超简单的面向过程的2个shell 分区以及创建lvm
分区 #!/usr/bin/env bash #fdisk /dev/sdb << EOF #n # # # #+600M #w #EOF 创建lvm pvcreate /dev/sdb ...
- IOS异常日志记录与展现功能
在平常的APP开发过程中经常碰到程序遇到异常闪退的问题,通过日志可以把相关的详细错误信息进行记录,本实例要记录不管在哪个页面出错都要进行记录,这边使用到的日志记录插件CocoaLumberjack,以 ...
- Log4Net日志记录两种方式
简介 log4net库是Apache log4j框架在Microsoft .NET平台的实现,是一个帮助程序员将日志信息输出到各种目标(控制台.文件.数据库等)的工具. log4net是Ap ...
随机推荐
- javascript 字符串数组链接
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- NK3C程序资源占用分析
1.程序放在一个Tomcat下最低配置推荐:最大堆:768M,最大PermGen:160M(-Xmx768m -XX:MaxPermSize=160m) 2.机器最低配置推荐:最小内存2G 3.正式运 ...
- windows下的php rabbit mq安装、配置
http://www.cnblogs.com/shanyou/p/4067250.html 这篇博文写的rabbit mq和erlang的安装以及rabbitmq可视化插件的一些操作 接下去开始安装P ...
- DAO实例代码优化
一般在接口的实现类中不用来实现登陆等功能,在测试类中实现并且测试. package com.beiwo.epet.service.impl; import com.beiwo.epet.dao.Mas ...
- 实现SQL Server 2008 Reporting Services匿名访问报表有两种方法
一.通过修改SQL Server 2008的配置文件,去掉Windows的验证. 1.首先我们找到SQL安装目录下的两个Web.config配置文件,默认安装目录分别是(C:\Program File ...
- Apache 的ab压力测试工具
ab.exe -n 请求次数 -c 并发人数
- Linux不使用useradd创建用户
手动创建用户的全过程:需要管理员权限. 1.在/etc/group中添加用户所属组的相关信息.如果用户还有辅助组则在对应组中加入该用户作为成员. 2.在/etc/passwd和/etc/shadow中 ...
- 修改eclipse运行内存的大小
一. 尝试修改Eclipse.ini 文件 (此方法不行) 找到eclipse 目录下的eclipse.ini 文件,修改下面的内容: -Xms40m -Xmx512m 修改后重启eclipse ...
- Bitmap简单操作笔记
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; ...
- jQuery multiselect的使用
1,下载插件 https://github.com/ehynds/jquery-ui-multiselect-widget