1826496 Members
2903 Online
109692 Solutions
New Discussion

Re: How to Remove a Disk

 
SOLVED
Go to solution
Mousa55
Super Advisor

How to Remove a Disk

Hi
i have rp8420 server,
How can I remove the disk "cxdxtx" to become unused?
and then remove the logical volume and then the volume group

thanks
8 REPLIES 8
Deepak Kr
Respected Contributor

Re: How to Remove a Disk

Hi,

To remove a disk you need to make sure disk should not contain any data.

Means that all data should move to other set of disks if there are multiple disks in the VG or if you dont require to save data you can simply proceed to remove disk..

you will be needing some set of commands:

pvmove ----to move data to other disks(PVs)
lvremove if logical vol is to be removed
vgreduce ::: to remove disk from VG with other disks

IF there is a single disk in VG and you want to clean it up (provided no data to be backup) then

you can run vgexport volume group(Be careful while you run it in production env)

Go through man pages of above commands to know more.

Also provide complete detail in case you need command syntax also.


"There is always some scope for improvement"
Prashanth Waugh
Esteemed Contributor
Solution

Re: How to Remove a Disk

Hi Nejad,
here i m providing some guideline. you decide according to your setup.

1)First move the data from one disk to another disk.
For eg.here we r moving the data c0t0d0 to c1t0d0
pvmove /dev/dsk/c0t0d0 /dev/dsk/c1t0d0
============================================
2) How to remove a Logical Volume
Note: the following example is using the volume group vg01 and the
logical volume lvhp
1) Backup all user data
2) Umount the filesystem
umount /home
3) remove the Logical volume
lvremove /dev/vg01/lvhp
==============================================================
3) How to remove a disk from a volume group
Note: the following example is using the disk c1t6d0 and the
volume group vg01

1) Make sure that the disk is not in use:
pvdisplay /dev/dsk/c1t6d0
Look at line starting with Allocated PE the number at the end
of the line should be 0. If it is not the disk is still in use.
2) Remove the disk
vgreduce /dev/vg01 /dev/dsk/c1t6d0
========================================================================
If you are using single pv in VG then u can export it to remove from vg.But it should be deactivate first.
#vgchange -a n vgname
#vgexport vgname
============================================================================
but u should rmember one thing when u r using the same PV for another VG then you
should use the -f option while creating the pv.
#pvcreate -f /dev/rdsk/c1t6d0
==========================================================================
while doing such type of activity u should take the backup first. Also go to man pages of every command. Dont do the blindley anything without understanding.Pls revert back if u have any doubts.

Regards
Prashant


For success, attitude is equally as important as ability
Rasheed Tamton
Honored Contributor

Re: How to Remove a Disk

Hi,

Backup the data
copy /etc/lvmtab
unmount filesystems
-umount /xxxxx

lvremove LVs
- lvremove /dev/vgxx/lvolxx

vgreduce (if there are more than one disk in the VG and you want to remove one by one)
-vgreduce /dev/vgxx /dev/dsk/cXtXdX

If the VG contains only one disk. Then you can use vgremove direclty on the VG after removing all the LVs.
-vgremove /dev/vgxx

(After that, tou can also use pvremove to remove LVM data structure from the disk
-pvremove /dev/rdsk/cXtXdX
check man pvremove). It can also be achived by pvcreate -f also.

Regards.
Mousa55
Super Advisor

Re: How to Remove a Disk

Hi,

and very thanks But the disk i you want to remove, Contains data but i don't needed.
Any difference in this case.

thanks
SKR_1
Trusted Contributor

Re: How to Remove a Disk

If you need to take only disk out, then you need to move the data of that disk onto other disk in same VG.

pvmove source-disk destination-disk

And if you dont need data on that disk.

Then you can perform below tasks.

lvremove lvname vgname
vgreduce vgname disk name
vgremove vgname
pvremove diskname

Thanks

SKR
Rasheed Tamton
Honored Contributor

Re: How to Remove a Disk

If you do not want the date - no need to backup.

Just go ahead and be very cautious when you type the device name of the disk. Make sure you use the correct device name.
Rasheed Tamton
Honored Contributor

Re: How to Remove a Disk

>If you do not want the date
If you do not want the data - typo
Mousa55
Super Advisor

Re: How to Remove a Disk

thanks for all