A2 |
The simplest way to do this is to create an array on the
new drive that has the same capacity as the
old drive in its entirety. Set up the array
and make it bootable, the re-partition then old
drive to match new one and add it to the array.
You can determine the correct size for the RAID partition by doing the
following:
-
Run
cfdisk /dev/hda where /dev/hda is
your new disk.
- Type
u Enter to change the unit to sectors.
- Type
p Enter to display the partition table
- Make a note of the size of a sector in bytes.
- Type
q Enter to exit the program
-
Run
cfdisk /dev/hdc where /dev/hdc is
your old disk.
- Type
u Enter to change the unit to sectors.
- Type
p Enter to display the partition table
-
Make a note of the total number of sectors on the disk as well as the
size of a sector in bytes.
- Type
q Enter to exit the program
-
Determine the size (in sectors) to use for the RAID partitions on the
old and new
drives.
-
If the sector size is the same on the old
and new drives then the partition size on both
disks is the same:
partition_sizenew
=
disk_sizeold
- 1
partition_sizeold
=
disk_sizeold
- 1
For example, if disk_sizeold=10000,
sector_sizeold=512 and
sector_sizenew=512 then:
partition_sizenew = 10000 - 1 = 9999
partition_sizeold = 10000 - 1 = 9999
-
If the sector size of the old drive is
larger than the the sector size on the new
drive then the partition size on the new
disk will be larger than the total number of sectors on the
old disk:
partition_sizenew = |
( disk_sizeold - 1 ) |
( |
sector_sizeold |
) |
|
sector_sizenew |
partition_sizeold
=
disk_sizeold
- 1
For example, if disk_sizeold=10000,
sector_sizeold=1024 and
sector_sizenew=512 then:
partition_sizenew = |
( 10000 - 1 ) |
( |
1024 |
) |
= ( 9999 ) ( 2 ) = 19998 |
|
512 |
partition_sizeold
= 10000 - 1 = 9999
Please note that since I do not have drives with differing sector sizes, I was unable to test this configuration. Proceed at your
own risk (and let me know if it works correctly).
-
If the sector size of the old drive is
smaller than the the sector size of the new
drive then the partition size on the new drive will
be smaller than the partition size of the old disk:
partition_sizenew = floor |
( |
( disk_sizeold - 1 ) |
( |
sector_sizeold |
) |
) |
- 1 |
|
sector_sizenew |
partition_sizeold = |
( |
( partition_sizenew + 1 ) |
( |
sector_sizenew |
) |
) |
- 1 |
|
sector_sizeold |
For example, if disk_sizeold=10000,
sector_sizeold=512 and
sector_sizenew=1024 then:
partition_sizenew = floor |
( |
( 10000 - 1 ) |
( |
512 |
) |
) |
- 1 |
= floor( 9999 × 0.5 ) - 1 |
= floor( 4999.5 ) - 1 |
= 4999 - 1 |
= 4998 |
|
1024 |
partition_sizeold = |
( |
( 4998 + 1 ) |
( |
1024 |
) |
) |
- 1 |
= ( 4999 × 2 ) - 1 |
= 9998 - 1 |
= 9997 |
|
512 |
Please note that since I do not have drives with differing sector sizes, I was unable to test this configuration. Proceed at your
own risk (and let me know if it works correctly).
-
Follow the main instructions for setting up the array with the following deviations:
-
When you use
fdisk to set up the RAID partition on the new
drive, enter 1 for the start sector of the partition and
partition_sizenew
as the end sector.
-
After you have set up the array and you can boot off it, but
before you run
raidhotadd to add the old
drive to the array, you will need to re-partition the old
drive:
-
Add partition to array using
raidhotadd as per the main instructions.
|