[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 ~]#