• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4843
  • Last Modified:

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

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.



0
rongvn85
Asked:
rongvn85
  • 9
  • 5
  • 4
  • +1
1 Solution
 
brittonvCommented:
Will it boot with the disk installed?

If so boot and edit your /etc/fstab file to remove the fault HD.
0
 
wesly_chenCommented:
Could you post the result of
pvscan
vgscan
lvscan
And also remove /backup entry in /etc/fstab, as brittonv mentioned.
0
 
rongvn85Author 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.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
wesly_chenCommented:
Try to do
pvremove -ff /dev/sdb2
0
 
rongvn85Author 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?
0
 
wesly_chenCommented:
what's the mount point for /dev/VolGroup00/LogVol00 and LogVol01?
Could you umount them first?
0
 
rongvn85Author 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.
0
 
wesly_chenCommented:
> /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.
0
 
rongvn85Author Commented:
/dev/VolGroup00/LogVol01 is the one i want to deactivate(remove) as it belongs to second hard drive which is failed
0
 
svsCommented:
So dismount it, lvremove it, and vgreduce the PV
0
 
rongvn85Author Commented:
Please give me clearly instructions so i can try.
Thanks
0
 
svsCommented:
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
0
 
rongvn85Author 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
0
 
rongvn85Author 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?
0
 
svsCommented:
Well, it's kind of obvious.  'swapoff' it then instead of 'umount'.
0
 
rongvn85Author 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?
0
 
svsCommented:
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
0
 
rongvn85Author 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?



0
 
svsCommented:
There's 0.28GB of LogVol00's data on /dev/sdb.  You need to move it somewhere -- but /dev/sda is full already; can you temporarily install a third drive in this machine?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now