We help IT Professionals succeed at work.

Can not remove second hard drive in Unix system!!!

6,072 Views
Last Modified: 2013-12-16
Hi everyone,
My server is using Centos 4.5. I use 2 hard drive,one for main files and one for backup purpose. I mounted second hard drive as /backup. Now it is failed to i need to remove it. But seem when I remove the second hard drive, system fail to boot, below is error message

ERROR: /bin/lvm exited abnormally!(pid 562)
Activating logical volumes
Couldn't find device with uuid 'YSOJQS.......
Couldn't find all physical volumes for volume group VolGroup00

Volume group "VolGroup00" not found
ERROR: /bin/lvm exited abnormally!(pid 563)
Creating root device
Mounting root filesystem
moung: error 6 mouting ext3
mount: error 2 mouting none
Switching to new root
switchroot: mount failed: 22
Umount /initrd/dev failed: 22
Kernel panic - not syncing: Attempted to kill init!

Seem that some system files are on the second drive.
Here is the result of fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1318 10482412+ 83 Linux
/dev/sda3 1319 2232 7341705 83 Linux
/dev/sda4 2233 30401 226267492+ 5 Extended
/dev/sda5 2233 2493 2096451 83 Linux
/dev/sda6 2494 30401 224170978+ 8e Linux LVM

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 30099 241770186 83 Linux
/dev/sdb2 30100 30401 2425815 8e Linux LVM

Here is the result of pvdisplay /dev/sdb2
--- Physical volume ---
PV Name /dev/sdb2
VG Name VolGroup00
PV Size 2.31 GB / not usable 983.00 KB
Allocatable yes
PE Size (KByte) 32768
Total PE 74
Free PE 3
Allocated PE 71
PV UUID YJ0JQs-fwpf-FGbn-v2xF-01Xj-rR9m-AU7eVG

When i run vgreduce VolGroup00 /dev/sdb2,i got
Physical volume "/dev/sdb2" still in use

I run vgchange -a n VolGroup00
then got
Can't deactivate volume group "VolGroup00" with 2 open logical volume(s)

[root@vietnam1 /]# pvremove /dev/sdb2
Can't pvremove physical volume "/dev/sdb2" of volume group "VolGroup00" withou t -ff

Please help me on this issue.



Comment
Watch Question

Commented:
Will it boot with the disk installed?

If so boot and edit your /etc/fstab file to remove the fault HD.
Top Expert 2011

Commented:
Could you post the result of
pvscan
vgscan
lvscan
And also remove /backup entry in /etc/fstab, as brittonv mentioned.

Author

Commented:
pvscan result
  PV /dev/sdb2   VG VolGroup00   lvm2 [2.31 GB / 96.00 MB free]
  PV /dev/sda6   VG VolGroup00   lvm2 [213.78 GB / 0    free]
  Total: 2 [216.09 GB] / in use: 2 [216.09 GB] / in no VG: 0 [0   ]

vgscan result
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2

lvscan result
  ACTIVE            '/dev/VolGroup00/LogVol00' [214.06 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [1.94 GB] inherit

I remove /backup entry in /etc/fstab and reboot the server sucessfully, sdb2 is a part of second hard drive so i can not the remove the hard drive.
Top Expert 2011

Commented:
Try to do
pvremove -ff /dev/sdb2

Author

Commented:
it does not work either
[root@vietnam1 /]# pvremove -ff /dev/sdb2
Really WIPE LABELS from physical volume "/dev/sdb2" of volume group "VolGroup00" [y/n]? y
  WARNING: Wiping physical volume label from /dev/sdb2 of volume group "VolGroup00"
  Can't open /dev/sdb2 exclusively - not removing. Mounted filesystem?
Top Expert 2011

Commented:
what's the mount point for /dev/VolGroup00/LogVol00 and LogVol01?
Could you umount them first?

Author

Commented:
Here is result for mount

/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,usrquota)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw,noexec,nosuid)
/dev/sda5 on /tmp type ext3 (rw,noexec,nosuid)
/dev/sda2 on /usr type ext3 (rw,usrquota)
/dev/sda3 on /var type ext3 (rw,usrquota)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/tmp on /var/tmp type none (rw,noexec,nosuid,bind)

I am not sure which one is mounted on sdb2 so can not umount them.
Top Expert 2011

Commented:
> /dev/mapper/VolGroup00-LogVol00 on / type ext3
It looks that /dev/VolGroup00/LogVol00 mount as /, which is system partition.
I don't have Linux machine on hand, will get back to you after some experiment.

Author

Commented:
/dev/VolGroup00/LogVol01 is the one i want to deactivate(remove) as it belongs to second hard drive which is failed
svs

Commented:
So dismount it, lvremove it, and vgreduce the PV

Author

Commented:
Please give me clearly instructions so i can try.
Thanks
svs

Commented:
Let's assume that $VG is volume group name, and $LV and $PV hold the full pathnames of logical and physical volumes you want to delete. These commands should be enough:

umount $LV
lvremove $LV
vgreduce $VG $PV

Author

Commented:
here is the result of first 2 command

[root@vietnam1 /]# umount /dev/VolGroup00/LogVol01
umount: /dev/VolGroup00/LogVol01: not mounted

[root@vietnam1 /]# lvremove /dev/VolGroup00/LogVol01
  Can't remove open logical volume "LogVol01"

[root@vietnam1 /]# vgreduce /dev/VolGroup00 /dev/sdb2
  Physical volume "/dev/sdb2" still in use

Below is mount result

[root@vietnam1 /]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,usrquota)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw,noexec,nosuid)
/dev/sda5 on /tmp type ext3 (rw,noexec,nosuid)
/dev/sda2 on /usr type ext3 (rw,usrquota)
/dev/sda3 on /var type ext3 (rw,usrquota)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/tmp on /var/tmp type none (rw,noexec,nosuid,bind)

Please help,thanks

Author

Commented:
Here is etc/fstab content

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 /                       ext3    defaults,usrquota        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults,nosuid,noexec,rw        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/usr              /usr                    ext3    defaults,usrquota        1 2
LABEL=/var              /var                    ext3    defaults,usrquota        1 2
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/tmp             /var/tmp                    ext3    defaults,bind,noauto        0 0


I think /dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0 is the reason why i can not remove second hard drive,it is used as swap?
svs

Commented:
Well, it's kind of obvious.  'swapoff' it then instead of 'umount'.

Author

Commented:
after run swapoff i can run the command
lvremove /dev/VolGroup00/LogVol01

but still got error

vgreduce /dev/VolGroup00 /dev/sdb2
  Physical volume "/dev/sdb2" still in use

fdisk -l result

[root@vietnam1 /]# fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1318    10482412+  83  Linux
/dev/sda3            1319        2232     7341705   83  Linux
/dev/sda4            2233       30401   226267492+   5  Extended
/dev/sda5            2233        2493     2096451   83  Linux
/dev/sda6            2494       30401   224170978+  8e  Linux LVM

Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       30099   241770186   83  Linux
/dev/sdb2           30100       30401     2425815   8e  Linux LVM


Can i now remove 2nd drive safely?
svs

Commented:
Post pvscan/lvscan results again, please. I think that LogVol00 uses a bit of space on /dev/sdb ...

pvscan result
  PV /dev/sdb2   VG VolGroup00   lvm2 [2.31 GB / 96.00 MB free]
  PV /dev/sda6   VG VolGroup00   lvm2 [213.78 GB / 0    free]
  Total: 2 [216.09 GB] / in use: 2 [216.09 GB] / in no VG: 0 [0   ]

lvscan result
  ACTIVE            '/dev/VolGroup00/LogVol00' [214.06 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [1.94 GB] inherit

Author

Commented:
pvscan result
[root@vietnam1 /]# pvscan
  PV /dev/sdb2   VG VolGroup00   lvm2 [2.31 GB / 2.03 GB free]
  PV /dev/sda6   VG VolGroup00   lvm2 [213.78 GB / 0    free]
  Total: 2 [216.09 GB] / in use: 2 [216.09 GB] / in no VG: 0 [0   ]

lvscan result
[root@vietnam1 /]# lvscan
  ACTIVE            '/dev/VolGroup00/LogVol00' [214.06 GB] inherit

Seem lvscan result is different but pvscan is still the same,what should i do now?



Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.