LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Expand disk size on centos VM? (https://www.linuxquestions.org/questions/linux-newbie-8/expand-disk-size-on-centos-vm-4175416556/)

Kustom42 07-16-2012 11:38 AM

If you don't see any open file locks run the following:

Code:


dmsetup info -c VolGroup00-LogVol01

If it shows a number "1" for the open status run the following:

Code:


dmsetup remove VolGroup00-LogVol01

You should then be able to execute the lvremove.

whizzit 07-16-2012 11:52 AM

Is LogVol01 mounted by any chance?

Code:

# lvcreate -L100M -n test /dev/vg0
  Logical volume "test" created
# mkfs -t ext3 /dev/vg0/test
mke2fs 1.42 (29-Nov-2011)
...
Allocating group tables: done                           
Writing inode tables: done                           
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

# lvs -a /dev/vg0/test
  LV  VG  Attr  LSize  Origin Snap%  Move Log Copy%  Convert
  test vg0  -wi-a- 100.00m                                     
# mount /dev/vg0/test /mnt/
# lvs -a /dev/vg0/test
  LV  VG  Attr  LSize  Origin Snap%  Move Log Copy%  Convert
  test vg0  -wi-ao 100.00m                                     

# lvremove /dev/vg0/test
  Can't remove open logical volume "test"
# umount /dev/vg0/test
# lvremove /dev/vg0/test
Do you really want to remove active logical volume test? [y/n]: y
  Logical volume "test" successfully removed
# lvs -a /dev/vg0/test
  One or more specified logical volume(s) not found.


Kustom42 07-16-2012 11:56 AM

It shouldnt be mounted, from the discussion we had this new lv got created. Unless it got mounted, which I can't see it from the steps the issue here is likely a file lock or the dmsetup.

jbennett 07-16-2012 01:36 PM

Quote:

Originally Posted by Kustom42 (Post 4729656)
Try doing:

Code:

lsof | grep -i LogVol01

Code:

bash: lsof : command not found
Quote:

See if there are any processes that have a lock on it. You don't have it mounted, so it shouldn't be giving you this error. Did you see anything in the verbose output in regards to the cause of the error? I know the -vvvv gives you alot of output but it should tell us at what point it errors.
I do see the following:

Code:

Can't remove open logical volume "LogVol01"

jbennett 07-16-2012 01:43 PM

Quote:

Originally Posted by Kustom42 (Post 4729661)
If you don't see any open file locks run the following:

I'm not sure how to check if I have any open file locks, but in the output of the previous command, I do see the following:

Code:

#mm/memlock.c:389                Unlock : Memlock counters: locked:0 critical:0 daemon:0 suspended:0
#locking/file_locking.c:74        Unlocking /var/lock/lvm/V_VolGroup00
#locking/file_locking.c:51        _undo_flock /var/lock/lvm/V_VolGroup00
#device/dev-io.c:588              Closed /dev/sda2
#device/dev-io.c:588              Closed /dev/sda3


jbennett 07-16-2012 01:46 PM

Quote:

Originally Posted by whizzit (Post 4729673)
Is LogVol01 mounted by any chance?

Sorry if this might seem dense, is the code you inserted to be followed? It seems that you're creating a 'test' logical volume and mounting it to /mnt then removing it. I'm not sure I understand the purpose (just trying to learn).

When I run df -h, I don't have LogVol01, I only have LogVol00, along with some other partitions. LogVol00 is still at 9.5G in size and is at 100% use.

Also, /dev/loop0 is at 100% of 130M in use. I'm not sure if that matters?

Thank you again for all of the help.

Kustom42 07-16-2012 02:00 PM

Did you run the dmsetup commands I provided? What was the output of those? I think that is the issue here preventing the LV from being removed.

whizzit 07-16-2012 02:23 PM

Quote:

Originally Posted by jbennett (Post 4729762)
Sorry if this might seem dense, is the code you inserted to be followed? It seems that you're creating a 'test' logical volume and mounting it to /mnt then removing it. I'm not sure I understand the purpose (just trying to learn).

I apologise for the confusion - the commands were not meant to be run (but is good that you questioned it rather than blindly running commands). It was merely to demonstrate that trying to lvremove a volume whilst it was mounted produced the same error you were/are having.

I'll take a step back and allow the thread to continue with Kustom42.

Regards

jbennett 07-16-2012 02:23 PM

Quote:

Originally Posted by Kustom42 (Post 4729661)
If you don't see any open file locks run the following:

Code:


dmsetup info -c VolGroup00-LogVol01


Code:

Name                Maj Min Stat Open Targ Event UUID
VolGroup00-LogVol01 253 1  L--w 1    2    0    LVM-.....

Quote:

If it shows a number "1" for the open status run the following:

Code:


dmsetup remove VolGroup00-LogVol01


Code:

device-mapper: remove ioctl failed: Device or resource busy
Command failed

Now, I suppose I need to know how to check for locked files. I found a few references to 'lsof' and 'lslk', however, being that I'm running on a LiveCD, I cannot install these. :(

Kustom42 07-16-2012 03:35 PM

Well, this is interesting...

That should allow you to remove it, add the -f option to the remove command.

dmsetup remove -f VolGroup00-LogVol01

jbennett 07-16-2012 03:53 PM

result as follows:

Code:

device-mapper: remove ioctl failed: Device or resource busy
Command Failed


Kustom42 07-16-2012 03:59 PM

Ok, well since you don't have access to lsof try this:

Code:

ps auxww | grep -i LogVol01
Let us know what the output of that is, something is locking this device and in all honesty it shouldnt unless you mounted it or started a process within that directory. This may be something related to the multipath daemon or udev but I'm not sure at this point. The ps command should show us whats happening.

jbennett 07-16-2012 04:03 PM

Code:

root 1618 0.0 0.1 4328 784 tty1 S+ 21:02 0:00 grep -i LogVol01
I'm guessing this means that there is something locking it as root, but I'm not sure how to figure out what? is it pid 1618?

if I do the following:

Code:

ps ax | grep 1618
I get the following:

Code:

1624 tty1 S+ 0:00 grep 1618
Which I'm assuming is saying essentially the same as the previous output, that tty1 is using it?

When I do 'df -H', I don't see LogVol01 listed, only LogVol00??

Kustom42 07-16-2012 06:51 PM

The ps output you are getting is for the grep process you are running. This is very odd, there are no processes with a file open so you should have no issue removing the logical volume.

I have seen this is in wierd situation before where the device was suspended, not sure if thats the case but its something to try.

Code:


dmsetup resume VolGroup00-LogVol01
dmsetup remove VolGroup00-LogVol01


jbennett 07-17-2012 07:57 AM

result as follows:

Code:

device-mapper: remove ioctl failed: Device or resource busy
Command Failed

If I understood more about what was happening I would attempt to research, but I'm not even sure what's causing this at this point. :(


All times are GMT -5. The time now is 04:57 PM.