LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Unable to remove lvm (https://www.linuxquestions.org/questions/linux-software-2/unable-to-remove-lvm-4175454298/)

flebber 03-16-2013 05:30 AM

Unable to remove lvm
 
I am trying to remove an lvm on my drive which sits in /dev/sda6.

However I don't see to be able to delete it I think maybe /dev is blocking it but not sure as haven't dealt much with lvm before.

This is what I have done.

Code:

kubuntu@kubuntu:~$ sudo df -kh
Filesystem      Size  Used Avail Use% Mounted on
/cow            1.9G  398M  1.5G  21% /
udev            1.9G  8.0K  1.9G  1% /dev
tmpfs          764M  888K  763M  1% /run
/dev/sdb        944M  944M    0 100% /cdrom
/dev/loop0      885M  885M    0 100% /rofs
none            4.0K    0  4.0K  0% /sys/fs/cgroup
tmpfs          1.9G  48K  1.9G  1% /tmp
none            5.0M  4.0K  5.0M  1% /run/lock
none            1.9G  80K  1.9G  1% /run/shm
none            100M  16K  100M  1% /run/user
kubuntu@kubuntu:~$ sudo lvs
  LV  VG                            Attr    LSize  Pool Origin Data%  Move Log Copy%  Convert
  root korora_sayth-travelmate-5740g -wi-a--- 44.60g                                         
  swap korora_sayth-travelmate-5740g -wi-a---  3.73g                                         
kubuntu@kubuntu:~$ sudo umount /
kubuntu@kubuntu:~$ sudo lvremove -f korora_sayth-travelmate-5740g
  Command failed with status code 5.
kubuntu@kubuntu:~$ sudo umount /dev
umount: /dev: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
kubuntu@kubuntu:~$


GlennsPref 03-16-2013 05:39 AM

Quote:

"The problem with reality is that it leaves a lot to the Imagination" - John Lenon.

Ah, shouldn't you unmount it and remove it from /etc/fstab

Type,
Code:

umount -a
and then remove the mount point in fstab.

Code:

cat /etc/mtab
will show what is mounted. And reboot!

You should be able to manipulate the partition after that.

flebber 03-16-2013 06:08 AM

Code:

kubuntu@kubuntu:~$ sudo cat /etc/mtab
/cow / overlayfs rw 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
/dev/sdb /cdrom iso9660 ro,noatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
none /run/user tmpfs rw,noexec,nosuid,nodev,size=104857600,mode=0755 0 0

Code:

umount: /run/user: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
umount: /run/shm: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
umount: /tmp: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
umount: /cdrom: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
umount: /run: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))
umount: /dev: device is busy.
        (In some cases useful info about processes that use
        the device is found by lsof(8) or fuser(1))


But there is actually nothing in fstab to edit. I need to stop /deve. so lvremove can remove the volume.

fstab
Code:

overlayfs / overlayfs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0


flebber 03-16-2013 06:23 AM

Code:

kubuntu@kubuntu:~$ sudo lvchange korora_sayth-travelmate-5740g
  Need 1 or more of -a, -C, -M, -p, -r, --resync, --refresh, --alloc, --addtag, --deltag, --monitor or --poll
  Run `lvchange --help' for more information.
kubuntu@kubuntu:~$ sudo lvchange -an korora_sayth-travelmate-5740g
kubuntu@kubuntu:~$ sudo lvremove korora_sayth-travelmate-5740g
Do you really want to remove active logical volume swap? [y/n]: y
Do you really want to remove active logical volume root? [y/n]: y
  Command failed with status code 5.
kubuntu@kubuntu:~$ sudo vgremove korora_sayth-travelmate-5740g
Do you really want to remove volume group "korora_sayth-travelmate-5740g" containing 2 logical volumes? [y/n]: y
Do you really want to remove active logical volume swap? [y/n]: y
  Command failed with status code 5.


michaelk 03-16-2013 07:11 AM

Can you provide some additional information as to what you are trying to accomplish. It appears that you are running a liveCD. /dev /udev are virtual filesystems and only exist in memory.

So what do you have installed on sda? Since no sda filesystems appear to be mounted you can use any tool i.e. parted to remove them.

flebber 03-16-2013 07:47 AM

Well I wanted to install kubuntu over fedora kde. However due to the fedora lvm gparted can not remove this. So I needed to delete the lvm to install.


I actually solved this but not in the way I would have liked. As its a dual boot PC I went into the windows partition manager and deleted it.

michaelk 03-16-2013 08:05 AM

In general most installers will provide the option to delete, use a specified partition or create partitions as desired.

flebber 03-16-2013 08:21 AM

Quote:

Originally Posted by michaelk (Post 4912823)
In general most installers will provide the option to delete, use a specified partition or create partitions as desired.

That was my experience previously , however the installers I tried and gparted were unable to. It seems they we're unable to I unmount it to change it.

syg00 03-16-2013 03:46 PM

Quote:

Originally Posted by flebber (Post 4912816)
I actually solved this but not in the way I would have liked. As its a dual boot PC I went into the windows partition manager and deleted it.

and the problem is ??? ... lol.

Now it's gone, it'll be hard to be sure, but I'd reckon the installer (or more correctly the liveCD boot sequence) used the swap in the lv. Swap doesn't show in the mount table, but "swapon -s" would have shown it.
Do a "swapoff <blah>" first, then deal with the LVM entities.

I'm actually surprised a Ubuntu derivative recognises and mounts LVM automatically.

jpollard 03-16-2013 03:55 PM

Erase the drive.

LVM records its activity in several places on the disk, so when the system starts, LVM attmepts to look at everything... and picks up on a disk even if you don't want it to.

michaelk 03-16-2013 03:55 PM

I do not think it was actually mounted either.

syg00 03-16-2013 04:23 PM

Quote:

Originally Posted by jpollard (Post 4913011)
Erase the drive.

Rubbish.

The OP has already apparently proven this is not necessary.
Distros that automatically run vgchange on boot can be a PITA sometimes (as the OP found out), but no LVM meta-data is stored outside of LVM pv's.

chrism01 03-18-2013 02:00 AM

Well, the conf is stored under /etc/lvm, which does not need to be on an LVM eg on the machine I'm typing from, I have no LVM setup at all (don't need or want), BUT
Code:

# pwd
/etc/lvm

# ll
total 52
drwx------. 2 root root  4096 Feb 22 16:21 archive
drwx------. 2 root root  4096 Feb 22 16:21 backup
drwx------. 2 root root  4096 Feb 22 16:21 cache
-rw-r--r--. 1 root root 37554 Feb 22 16:21 lvm.conf

Maybe it was trying to use that from eg an old setup?

gdejonge 03-20-2013 03:23 AM

I think the problem that OP had, was that he tried lvremove operations on the volume group.
korora_sayth-travelmate-5740g is the name of the volume group.
The logical volumes are named root and swap.

Normal way would be
Code:

lvremove /dev/korora_sayth-travelmate-5740g/root
lvremove /dev/korora_sayth-travelmate-5740g/swap
vgchange -a n korora_sayth-travelmate-5740g
vgremove korora_sayth-travelmate-5740g



All times are GMT -5. The time now is 03:25 AM.