1752800 Members
5785 Online
108789 Solutions
New Discussion юеВ

Re: New disks

 
SOLVED
Go to solution
Sanjay Tailor
Frequent Advisor

New disks

Hello,

I have a D-box on 10.20. I have three 4gb drives and one 2 gb drive. My databse application resides on one 4 gb drive for now. This drive is /dev/dsk/c0t8d0. I want to buy a 9 gb drive, take all the data in this aplication drive and move it to the bigger 9gb drive. How can I do this? Is there a way to copy from the 4gb drive to the 9gb drive directly?

I am not mirroring now but would like to set it up later. If I set up mirroring for this drive, would I need another 9gb drive to achieve mirroring?
9 REPLIES 9
Dan_4
Advisor

Re: New disks

One way to copy the data directly would be dd, but probably an easier way would be using find and cpio with the passthrough (-p) option. Check the man page for both for examples.

You would create a new VG with the new 9G disk in it, then use find/cpio to copy the info over.

You don't have to mirror disks to similar disks, because you really mirror the lvols. You just need to make sure you have enough free space in the VG to mirror to. Once you've moved the data over to the 9G disk, you could put the old disks into the new VG and mirror the lvols to them.
Sanjay Tailor
Frequent Advisor

Re: New disks

Hello Dan,

Thanks for the reply. Why would I need to create a new VG? Maybe I didn't communicate it right but once I copy all the data over to the 9gb, I want to physically move the 9gb into the slot that the 4gb occupies. Basiically, I have /dev/vg01 on the 4gb now and want to switch the 4gb with a new 9gb. The old 4gb would then become unused and the 9gb would take over.

I am not sure if this confuses the issue or your answer still stands.

Thanks for your help.

Shyam Kishore
Frequent Advisor

Re: New disks

Hi,

I presume that you have VG01 with a lvol of size of 4GB in a single disk.

First unmount the lv and deactivate the VG01 by

# vgchange -a n vg01


Now simply add the new disk to the VG01 using.

# vgextend vg01

then move the total data to new disk using.

# pvmove

It will copy the total data from old disk to new disk, then simply remove the old disk from VG01 by

# vgreduce

then activate the VG

# vgchange -a y

after doing the above you still have the same size of lv i.e 4GB only, you can simply increase to 9GB using

# lvextend -L 9216
#extendfs
#mount -a
After changing all the above you can simply remove the old disk.

2.

If you want to do mirror in future you should have a free disk of your Logical volume size at least. you should include the disk in same VG to perform mirroring. (MIRROR/UX is a priced product)

-Shyam
Kids learn from masters, masters from mistakes.
Carlos Fernandez Riera
Honored Contributor

Re: New disks

Just a comment:

Before extend you vg01 check it for max PE per PV parameter ( vgdisplay). If it is set to 1024 ( 4Gb) you would extend, but your 9Gb disk will be as your 4Gb.
This parameter cant be changed, and you will have to creteate a new vg.
unsupported
Andreas Voss
Honored Contributor
Solution

Re: New disks

Hi,

i've read you question and the answers.
By that i think your job is a little bit complexer.
If you want to add your 9GB drive into the vg01 you would get an error because your vg01 was initially created with no 9GB drives. So the maximum number of physical extends (max_pe) would be 1016 (if you do not modified this value at creation time of the vg).
For a 9GB drive you must have a max_pe of 2171 or higher.
The only way i see is to create a new vg with your 9GB drive and then copy the data with the method Shyam described.
The next problem i saw is that you want to replace the existing 4GB drive with the new 9GB drive at the same physical slot.
If you want to do so you must first vgexport your vg01 (with the 4GB drive) and your new vg (with the 9GB drive), replace the drives, reboot the box and vgimport your new vg with the correct device. By this way you have the chance to vgimport your previous newly created vg with the 9GB drive to the vg01.
So here is my concept:
Put the 9GB drive in a free slot.
Do an ioscan -fC disk an look for the line with the new drive where you can record the hardware path an see the scsi address.
Make the special files for the drive with insf -H
Create the new physical volume with
pvcreate /dev/rdsk/c0t#d0 (# is the scsi address)
Create a new volume group:
mkdir /dev/vg02
mknod /dev/vg02/group c 64 0x000002
vgcreate vg02 /dev/dsk/c0t#d0
You have to care what minor number you use for the new volume group. If 2 is already used take a uniq one.
Create a logical volume in vg02:
lvcreate -L vg02
Make a new filesytem on the new log. volume:
newfs -F vxfs /dev/vg02/rlvol1
Mount the new filesystem:
mkdir /new
mount /dev/vg02/lvol1 /new
The steps above are also avaiable by SAM. It's by you to choose the method.
Now you can copy the data:
cd
find . -depth |cpio -pmdv /new
When this finished unmount both filesystems:
umount
umount /new
Make the vg01 and vg02 inactive:
vgchange -a n vg01
vgchange -a n vg02
Export both vg's:
vgexport -v vg01
vgexport -v vg02
Shutdown your system:
shutdown -h 0
Replace the drives
Boot your system
Import the new vg as vg01:
mkdir /dev/vg01
mknod /dev/vg01/group c 64 0x000001
vgimport -v vg01 /dev/dsk/c0t8d0
vgchange -a y vg01
mount
ATTENTION: I don't know if your vg01 has the minor number 1. So be careful but i think it is so.
Now you have your data on the 9GB drive at the same vg the 4GB drive was before.

Hope i have made no mistakes.

Greetings

Andrew
Carlos Fernandez Riera
Honored Contributor

Re: New disks

hi all:

You are forgetting one thing. Lvols can be newfs'd or not ( raw ).

Cpio -pdu is a correct option if all lvols are filesystems, but lvols used as raw must be copied using dd.

A great document Andrew.
unsupported
freddri
Advisor

Re: New disks

Another thing to note that with planning you can use vgcreate -e -s to allow for larger disks in the future. Otherwise the os will use the first disk put in the vg to decide what the pe size and max pe should be. So today you could make a vg with 5 9 gb disks and allow for 80 gb disks in the future if you do a:
vgcreate -e 80000 -s 8

Why not do it, who knows how big disks will be in 5 or 10 years. Doesn't cost you anything
freddri
Advisor

Re: New disks

sorry, that would allow for a 64 GB disk
Dan_4
Advisor

Re: New disks

Sorry I wasn't clear on my initial answer. I treated the maxPE/PV issue as assumed :) That's why you'd have to create a new VG.

Regarding the last answer about using the -e option to set your maxPE/PV to a very high number:

You don't want to do this unless you are sure you need to, because using a higher number increases the amount of overhead the system creates for LVM structures on the disks. This wastes space on the disks as well as affects performance. Both of these are often negligible if you set it for 18G disks, but making room for a 64G disk on your current 9G drives would have a definite impact.