This appendix discusses the following:
Table B-1 shows the format of an XVM DVH-labeled disk.
Table B-1. DVH-Labeled Disk Layout
Block | Size in blocks | Contents |
|---|---|---|
0 | 1 | Label (such as partition information) |
1 | 3071 | Usually unused |
3072 | 1024 | XVM metadata |
4096 | data_length | User data |
| unused_length | Unused space due to 2-MB rounding |
Table B-2 shows example format of an XVM GPT-labeled disk.
| Note: Although partition 1 could start at block 34, for simplicity the example uses block 40. The first GPT partition for the XVM metadata must start within the first 64 blocks of the start of the disk. |
Table B-2. GPT-Labeled Disk Layout
Block | Size in blocks | Contents |
|---|---|---|
0 | 1 | Master boot record |
1 | 1 | GUID partition table header |
2 | 32 | GUID partition entries |
40 | data_length | Partition 1: XVM metadata (approximately 2 MB) followed by user data |
End - 33 | 32 | Backup GUID partition entries |
End - 1 | 1 | Backup GUID partition table header |
A DVH-labeled disk can have data going all the way to the end of the disk but a GPT-labeled disk must have up to 33 blocks at the end of the disk (the normal partitioning process should automatically leave the required space at the end of the disk, and XVM will not try to use it):
1 block for the backup GUID partition table header
Up to 32 blocks for the backup GUID partition entries
Therefore, there must be almost 33 blocks (17 KB if 512-bytes/block) free at the end of a disk so that there is room for the backup GPT information. In some cases, this will be available and the partitioning tools can place the backup GPT in the used space at the end of the disk. This is not normally the case, but can happen if the disk is part of a stripe. Usually stripes will not align exactly with the end of a disk and so there may be enough unused space at the end to place the backup GPT header and backup partition entries.
To convert to GPT format, note the following:
start_of_userdata is the block number where the user data started
end_block_number is the ending block number of the user data
data_length is the number of blocks of user data
If you do not have 17 KB free at the end of the disk, you can still convert, but it will be more complicated because you must first free 17 KB from the end of the disk. Because the DVH user data partition is using this space, you should move the last 512 KB (or whatever size greater than 17 KB that you want) into the first 4096 blocks of the DVH label that is not used, say starting at block 3072 for simplicity.
Suppose that you have a DVH disk layout shown in Table B-3 to the GPT label format shown in Table B-4 by using Procedure B-1.
Block | Size (in blocks) | Contents |
|---|---|---|
0 | 1 | Label - such as partition information |
1 | 3071 | Usually unused |
3072 | 1024 | XVM metadata |
4096 | data_length | User data |
Block | Size (in blocks) | Contents |
|---|---|---|
0 | 1 | Master boot record |
1 | 1 | GUID partition table header |
2 | 32 | GUID partition entries |
40 | data_length | XVM metadata (approximately 1.5 MB) followed by user data |
3072 | 1024 | 512 KB of data copied from end of disk (make this slice0) |
4096 | data_length - 1024 | original_data - 256 KB at end that was moved (make this slice1) |
end - 33 | 33 | Backup GUID partition entries and header |
The following procedure walks through the steps required to move some user data from the end of the LUN address space (where the GPT backup label will be placed) to a place in the front part of the address space once used by the DVH label but not needed by the GPT label.
Procedure B-1. Converting a DVH Label to a GPT Label
Gather information about the original physvol using the xvm show command and parted. For example, for a volume named volume_B4:
petrel:~ # xvm show -v volume_B4 XVM physvol phys/volume_B4 ========================= size: 419425280 blocks sectorsize: 512 bytes state: online,local,accessible uuid: 36d4ea9f-9a77-4d06-9436-d6abede944f8 system physvol: no path manager device: /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 on host petrel using paths: /dev/xscsi/pci-0000:0b:00.0-sas-0x500a0b82fc281004-lun1 <sdc 8:32> affinity=none ws Disk has the following XVM label: Clusterid: 0 Host Name: petrel Disk Name: volume_B4 Magic: 0x786c6162 (balx) Version 2 Uuid: 36d4ea9f-9a77-4d06-9436-d6abede944f8 last update: Thu Mar 7 13:45:31 2013 state: 0x91<online,local,accessible> flags: 0x0<idle> secbytes: 512 label area: 1024 blocks starting at disk block 4096 (10 used) user area: 419425280 blocks starting at disk block 5120 Physvol Usage: Start Length Name --------------------------------------------------- 0 419425280 slice/volume_B4s0 Local stats for phys/volume_B4 since being enabled or reset: ------------------------------------------------------------------------------ stats collection is not enabled for this physvol |
petrel:~ # parted /dev/sdc GNU Parted 2.3 Using /dev/sdc Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) unit s (parted) print Model: SGI IS300 (scsi) Disk /dev/sdc: 419430400s Sector size (logical/physical): 512B/512B Partition Table: dvh Number Start End Size Type File system Name Flags 9 0s 7167s 7168s extended 17 2s 2s 1s logical backvh (parted) quit |
This output provides the following information:
The LUN size in sectors (from parted): 419430400
start_of_userdata (block number where the user data started): 5120
data_length (the number of blocks of user data): 419425280
end_block_number is 419430400 (that is, 419425280 + 5120 = 419430400)
| Note: If the end_block_number is less than the LUN size by more than 33 blocks, there is room for the backup GPT label and no data copying is necessary. |
For this example, the user area runs all the way to the end of the LUN and the slice runs all the way to the end of the user area, therefore some data copying will be necessary.
Copy 1024 sectors to the space that will be unused by the GPT label:
Source: start 419430400 - 1024 = 419429376
Destination: start 5120 - 1024 = 4096
Make sure that the volume is unmounted and use the dd(8) command to copy the data:
petrel:~ # dd if=/dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 \
of=/dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 \
skip=419429376 seek=4096 count=1024
1024+0 records in
1024+0 records out
524288 bytes (524 kB) copied, 0.0860166 s, 6.1 MB/s |
Use parted to put a GPT label and partition on the disk, ignoring the warnings:
petrel:~ # parted /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 GNU Parted 2.3 Using /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) mklabel gpt Warning: The existing disk label on /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted) unit s (parted) mkpart primary 40 419429376 Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel? i Error: Error informing the kernel about modifications to partition /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2_part1 -- Invalid argument. This means Linux won't know about any changes you made to /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2_part1 until you reboot -- so you shouldn't mount it or use it in any way before rebooting. Ignore/Cancel? i (parted) print Model: Unknown (unknown) Disk /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2: 419430400s Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 40s 419429376s 419429337s primary (parted) quit Information: You may need to update /etc/fstab. |
| Note: The above example starts the GPT partition ( start_of_partition1) at sector 40, but any value between 34 (the end of the default GPT label) and 63 (required by XVM to speed up probing) could have been chosen. |
Calculate the length of the XVM label area:
start_of_userdata - (start_of_partition1 + 1) = XVM_label_area_length |
In this case, given that partition 1 starts at sector 40 as noted in the previous step:
4096 - 41 = 4055 |
The user data area should start at the beginning of the piece of user data that was copied from the end of the LUN, at sector 4096. The user data area starts immediately after the XVM label area. In this case, the XVM label area is 4055 blocks.
Add an XVM label that is compatible with the new GPT label, specifying the length of the XVM label area:
server# xvm label -name volname -use-exclusion-zones -xvmlabelblks XVM_label_area_length |
For example, showing the results:
petrel:~ # xvm label -name volume_B4 -use-exclusion-zones -xvmlabelblks 4055 /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 volume_B4 Performing automatic probe for alternate paths. Performing automatic path switch to preferred path for phys/volume_B4. petrel:~ # xvm show -v volume_B4 XVM physvol phys/volume_B4 ========================= size: 419425281 blocks sectorsize: 512 bytes state: online,local,accessible uuid: 97e1a578-91aa-47b7-aa52-697e572837fb system physvol: no path manager device: /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 on host petrel using paths: /dev/xscsi/pci-0000:0b:00.0-sas-0x500a0b82fc281004-lun1 <sdc 8:32> affinity=none ws Disk has the following XVM label: Clusterid: 0 Host Name: petrel Disk Name: volume_B4 Magic: 0x786c6162 (balx) Version 2 Uuid: 97e1a578-91aa-47b7-aa52-697e572837fb last update: Thu Mar 7 15:05:05 2013 state: 0x91<online,local,accessible> flags: 0x0<idle> secbytes: 512 label area: 4055 blocks starting at disk block 41 (10 used) user area: 419425281 blocks starting at disk block 4096 Physvol Usage: Start Length Name --------------------------------------------------- 0 419425281 (unused) Local stats for phys/volume_B4 since being enabled or reset: ------------------------------------------------------------------------------ stats collection is not enabled for this physvol |
Create two slices:
The first slice is the copied data, or the first 1024 blocks in the user data (length 1024)
The second slice is the rest of the partition or the user_data_length - 1024 (length 419425280 - 1024 = 419424256)
For example, showing the results:
petrel:~ # xvm slice -start 0 -length 1024 phys/volume_B4 </dev/lxvm/volume_B4s0> slice/volume_B4s0 petrel:~ # xvm slice -start 1024 -length 419424256 phys/volume_B4 </dev/lxvm/volume_B4s1> slice/volume_B4s1 petrel:~ # xvm show -v volume_B4 XVM physvol phys/volume_B4 ========================= size: 419425281 blocks sectorsize: 512 bytes state: online,local,accessible uuid: 97e1a578-91aa-47b7-aa52-697e572837fb system physvol: no path manager device: /dev/pm/SGI-IS300--2-600a0b80002fc28100000856489224f2 on host petrel using paths: /dev/xscsi/pci-0000:0b:00.0-sas-0x500a0b82fc281004-lun1 <sdc 8:32> affinity=none ws Disk has the following XVM label: Clusterid: 0 Host Name: petrel Disk Name: volume_B4 Magic: 0x786c6162 (balx) Version 2 Uuid: 97e1a578-91aa-47b7-aa52-697e572837fb last update: Thu Mar 7 15:05:05 2013 state: 0x91<online,local,accessible> flags: 0x0<idle> secbytes: 512 label area: 4055 blocks starting at disk block 41 (10 used) user area: 419425281 blocks starting at disk block 4096 Physvol Usage: Start Length Name --------------------------------------------------- 0 1024 slice/volume_B4s0 1024 419424256 slice/volume_B4s1 419425280 1 (unused) Local stats for phys/volume_B4 since being enabled or reset: ------------------------------------------------------------------------------ stats collection is not enabled for this physvol |
| Note: You can label, unlabel, create slices, and delete slices until you have the correct configuration. |
Concatenate the copied data to the end of the original data (minus the copied data) to get a volume back that will exactly match the beginning volume. For example, showing the results:
petrel:~ # xvm concat -volname testvol slice/volume_B4s1 slice/volume_B4s0
</dev/lxvm/testvol> concat/concat1
petrel:~ # xvm show -t vol/testvol
vol/testvol 0 online,accessible
subvol/testvol/data 419425280 online,accessible
concat/concat1 419425280 online,tempname,accessible
slice/volume_B4s1 419424256 online,accessible
slice/volume_B4s0 1024 online,accessible |