Linux中Xenserver新增本地存储示例

[root@xenserver-DS-Monitor02 ~]# smartctl --all /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0+10] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
 
=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.14 (AF)
Device Model:     ST3000DM001-1ER166
Serial Number:    W502PMVC
LU WWN Device Id: 5 000c50 09b03e160
Firmware Version: CC26
User Capacity:    3,000,592,982,016 bytes [3.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Aug 12 01:07:32 2016 CST
 
==> WARNING: A firmware update for this drive may be available,
see the following Seagate web pages:
http://knowledge.seagate.com/articles/en_US/FAQ/207931en
http://knowledge.seagate.com/articles/en_US/FAQ/223651en
 
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
 
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
 
General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                (   89) seconds.
Offline data collection
capabilities:                    (0x73) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        No Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 314) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x1085) SCT Status supported.
 
SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   100   100   006    Pre-fail  Always       -       374688
  3 Spin_Up_Time            0x0003   094   094   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       16
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   100   253   030    Pre-fail  Always       -       143
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       1
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       16
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0 0 0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   071   070   045    Old_age   Always       -       29 (Min/Max 26/29)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       3
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       34
194 Temperature_Celsius     0x0022   029   040   000    Old_age   Always       -       29 (0 24 0 0 0)
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       0h+24m+34.501s
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       20728
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       25675
 
SMART Error Log Version: 1
No Errors Logged
 
SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]
 
 
SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
 
[root@xenserver-DS-Monitor02 ~]# xe host-list
[root@xenserver-DS-Monitor02 ~]# xe host-list
uuid ( RO)                : e46c7c34-5d62-4b73-93d2-1dae3a47eb47
          name-label ( RW): xenserver-DS-Monitor02
    name-description ( RW): Default install
 
 
[root@xenserver-DS-Monitor02 ~]# xe host-list|awk 'NR==1{print $3}'
RO)
[root@xenserver-DS-Monitor02 ~]# xe host-list|awk -F':' 'NR==1{print $2}'
 e46c7c34-5d62-4b73-93d2-1dae3a47eb47
[root@xenserver-DS-Monitor02 ~]# xe host-list|awk -F': ' 'NR==1{print $2}'
e46c7c34-5d62-4b73-93d2-1dae3a47eb47
[root@xenserver-DS-Monitor02 ~]# xe sr-create content-type=user device-config:device=/dev/sda3 host-uuid=$(xe host-list|awk -F': ' 'NR==1{print $2}') name-label="Local storage" shared=false type=lvm
1bf6873f-243a-8e78-af92-df1d43a49566
[root@xenserver-DS-Monitor02 ~]# xe sr-list
uuid ( RO)                : 5344a404-3c3f-eaed-6ad3-688c5af50c00
          name-label ( RW): Removable storage
    name-description ( RW):
                host ( RO): xenserver-DS-Monitor02
                type ( RO): udev
        content-type ( RO): disk
 
 
uuid ( RO)                : 1bf6873f-243a-8e78-af92-df1d43a49566
          name-label ( RW): Local storage
    name-description ( RW):
                host ( RO): xenserver-DS-Monitor02
                type ( RO): lvm
        content-type ( RO): user
 
 
uuid ( RO)                : 1a8d857d-7789-22a2-0107-b50557eee7b7
          name-label ( RW): DVD drives
    name-description ( RW): Physical DVD drives
                host ( RO): xenserver-DS-Monitor02
                type ( RO): udev
        content-type ( RO): iso
 
 
uuid ( RO)                : ed3cc2ee-c279-9faa-a025-0d25259a6c3e
          name-label ( RW): XenServer Tools
    name-description ( RW): XenServer Tools ISOs
                host ( RO): xenserver-DS-Monitor02
                type ( RO): iso
        content-type ( RO): iso
 
 
[root@xenserver-DS-Monitor02 ~]# sgdisk -p /dev/sdb
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!
 
Invalid partition data!
[root@xenserver-DS-Monitor02 ~]# sgdisk -og /dev/sdb
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!
 
Invalid partition data!
Information: Creating fresh partition table; will override earlier problems!
The operation has completed successfully.
[root@xenserver-DS-Monitor02 ~]#

 


 


由上信息可以看出这是一块崭新的磁盘,现在需要将这个磁盘加到Xenserver的本地存储中,下面来开始操作
先将/dev/sdb磁盘设置为GPT分区

[root@xenserver-DS-Monitor02 ~]# sgdisk -og /dev/sdb
Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!
 
Invalid partition data!
Information: Creating fresh partition table; will override earlier problems!
The operation has completed successfully.
[root@xenserver-DS-Monitor02 ~]# sgdisk -p /dev/sdb
Found valid GPT with corrupt MBR; using GPT and will write new
protective MBR on save.
Disk /dev/sdb: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): A4C214E2-B75B-45D5-A8E9-B29E761C439D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 5860533101 sectors (2.7 TiB)
 
Number  Start (sector)    End (sector)  Size       Code  Name
[root@xenserver-DS-Monitor02 ~]#

 


新建一个磁盘分区/dev/sdb1

[root@xenserver-DS-Monitor02 ~]# sgdisk -n 1:0 -c 1:"LVM" -t 1:8e00 /dev/sdb
Found valid GPT with corrupt MBR; using GPT and will write new
protective MBR on save.
The operation has completed successfully.
[root@xenserver-DS-Monitor02 ~]# sgdisk -p /dev/sdb
Disk /dev/sdb: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): A4C214E2-B75B-45D5-A8E9-B29E761C439D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
 
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      5860533134   2.7 TiB     8E00  LVM
[root@xenserver-DS-Monitor02 ~]#

 


分区好了,我们就可以直接将磁盘加到Xenserver的本地存储中了

[root@xenserver-DS-Monitor02 ~]# xe host-list
uuid ( RO)                : e46c7c34-5d62-4b73-93d2-1dae3a47eb47
          name-label ( RW): xenserver-DS-Monitor02
    name-description ( RW): Default install
 
 
[root@xenserver-DS-Monitor02 ~]# xe sr-create content-type=user device-config:device=/dev/sdb1 host-uuid=e46c7c34-5d62-4b73-93d2-1d9ae3a47eb47 name-label="Local storage 2" shared=false type=lvm
bebbe4f1-a492-c434-ea7f-1f7cc679070c
[root@xenserver-DS-Monitor02 ~]# xe sr-list name-label="Local storage 2"
uuid ( RO)                : bebbe4f1-a492-c434-ea7f-1f7cc679070c
          name-label ( RW): Local storage 2
    name-description ( RW):
                host ( RO): xenserver-DS-Monitor02
                type ( RO): lvm
        content-type ( RO): user
 
 
[root@xenserver-DS-Monitor02 ~]#

时间: 2024-10-10 04:33:03

Linux中Xenserver新增本地存储示例的相关文章

LFCS 系列第五讲:如何在 Linux 中挂载/卸载本地文件系统和网络文件系统(Samba 和 NF

LFCS 系列第五讲:如何在 Linux 中挂载/卸载本地文件系统和网络文件系统(Samba 和 NF Linux 基金会已经发起了一个全新的 LFCS(Linux 基金会认证系统管理员Linux Foundation Certified Sysadmin)认证,旨在让来自世界各地的人有机会参加到 LFCS 测试,获得关于有能力在 Linux 系统中执行中间系统管理任务的认证.该认证包括:维护正在运行的系统和服务的能力.全面监控和分析的能力以及何时向上游团队请求支持的决策能力. LFCS 系列第

linux中更改MySQL数据库存储路径和端口

linux中更改MySQL数据库存储路径和端口 假设我们以更改到/opt/data目录下为倒: 1.opt目录下建立data目录 mkdir /opt/data 2.停掉MySQL服务进程 mysqladmin -u root -p shutdown 3.把/var/lib/mysql整个目录移到/opt/data mv /var/lib/mysql /opt/data/ 这样就把MySQL的数据文档移动到了/opt/data/mysql下 . 4.my.cnf文档配置 默认安装时my.cnf在

新增本地存储功能 山石网科发布下一代防火墙新品

网络安全空间厂商山石网科宣布发布下一代防火墙新产品--增加本地存储功能的山石网科E系列下一代防火墙.本次发布的E系列产品包含8款型号,具备日志.报表本地存储功能,覆盖更多的应用场景,满足用户对存储的需求,提升用户日常运维效率. 山石网科下一代防火墙在新增本地存储日志与报表数据功能后,可用于用户日常运维,也可用于设备监控.行为监管.调查取证.安全审计等场景,既满足<网络安全法>对日志存储不少于6个月的的要求,又能为客户提供简单高效的日志和报表统计.查询的手段,整体提升用户使用体验,满足企业.金融

Linux中Xenserver新装之后没有本地存储的解决方法

先来查看下硬盘信息 [root@xenserver-DS-Monitor01 ~]# smartctl --all /dev/sda smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0+10] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org   === START OF INFORMATION SECTION ===

linux中XenServer虚拟机扩容LVM磁盘分区

说明:XenServer里面安装的虚拟机,分区的时候采用的是LVM磁盘分区 需求:现在需要扩容虚拟机根分区/ 具体操作: 一.使用XenCenter增大虚拟机磁盘容量,如下图所示 增大当前磁盘到50GB 注意:必须在虚拟机关机状态下进行 二.查看硬盘容量 df -h #可以看到此时根分区还是12G,没有变化 fdisk -l #已经可以看到整个磁盘容量变为53.6GB了 三.创建新的磁盘分区 fdisk /dev/xvda #对磁盘/dev/xvda进行操作 p #查看当前分区 n #创建新分区

linux中Bash重定向输出使用示例

重定向标准输出 > 重定向当前命令的标准输出(STDOUT)到一个文件或者一个描述符. 下面的例子把ls命令的输出存到file.txt文件 ls >file.txt > file.txt ls 目标文件如果不存在就会被创建,或者文件被截断. 如果不指定,默认重定向描述符是标准输出或1.下面的命令等同于上面的例子: ls 1>file.txt 追加 vs 截断 截断 > 1.如果文件不存在则创建 2.截断(删除文件内容) 3.写入文件 $ echo "first li

linux中if case语句用法示例

shell中的if 和case两个条件语句 1. if的语法1:     if     条件     then     commands     else     commands     fi if的语法2:   语法:if 条件         then           commands         elif 条件         then            commands         elif 条件         then             commands   

linux中Bash内部变量使用示例

$@ "$@"把所有的命令行参数作为一个数组返回.与"$*"不一样,它是作为一个字符串来返回. "$@"可以通过循环来遍历所有元素,如下脚本: #!/bin/bash for var in "$*"; do     echo $var done 因为$*只把参数作为一个字符串返回,echo就只被调用一次: ~> $ ./testscript.sh firstarg secondarg thirdarg firstarg

Linux中mount挂载命令的示例用法

fat32分区 mount -o codepage=936,iocharset=cp936 /dev/hda7 /mnt/cdrom ntfs 分区 mount -t ntfs -o codepage=936,iocharset=cp936 /dev/hda7 /mnt/cdrom iso 文件 mount -o loop /abc.iso /mnt/cdrom 软盘 mount /dev/fd0 /mnt/floppy usb mount /dev/sda1 /mnt/cdrom cd光驱 m