PDA

View Full Version : How to remove existing lvm without reinitializing hdd


Diomedea
22nd November 2009, 03:05 PM
Hello everybody!

Here's the problem: I have a dual-boot system with XP and Fedora. I had to reinstall XP a while ago. After XP reinstallation, to regain access to Fedora, I ran Fedora installation DVD. It told me that the hdd had a "loop file system" and that I had to reinitialize it. I chose "ignore", "upgrade" and then "Create new boot loader configuration". Everything works fine now, but when I tried to install F11 from a live cd I discovered that I couldn't. It can't edit the lvm part (nor delete it). The only things possible are to reintall F10 with the DVD that created the lvm in the first place or install F11 using preupgrade (the lvm remains ext3 so preupgrade can't edit it either).

My question is: how can I get rid of the lvm part without reinitializing the hdd (I don't want to lose the data on the other partitions). I want to reinstall Fedora but without lvm.

I heard something about "fdisk" and "lvremove", but I have no idea how to use these, so I would like a detailed solution (something close to a tutorial).

Thank you!

DBelton
22nd November 2009, 09:55 PM
You are talking ab out 2 different things here and I really would like to clarify before going farther.

There is a big difference in "loop file system" and "lvm"

Loop filesystem is where you have a file that is accessed as a device. The file contains the filesystem and can be mounted.

losetup --all

run as root or su will give you the status of loop devices

unmount /dev/loop0
losetup -d /dev/loop0

will detach the file from the loop0 device.

Diomedea
23rd November 2009, 07:34 PM

Thank you for your answer DBelton!

I didn't say that "lvm" and "loop file system" were the same thing. I just said that Anaconda gave me this message and that it requested to initialize the hdd and also that I can't get rid of the lvm. I can't format, delete or modify that part of the hdd.

So can I get rid of the lvm? (Of course, if the answer is yes, I would also like to know how)

Also, I understand from your answer that it might be possible for me to recover the filesystem. If that is so, could you please give me a more detailed explanation of those commands. I'm not exactly a command line expert.

DBelton
24th November 2009, 05:21 AM
oh. now I understand what your problem is. the livecd can't install onto an ext3 lvm since the livecd is ext4.

You can download the full install of fedora 11 or fedora 12 and do an upgrade of your existing system from the complete install media.

Diomedea
24th November 2009, 11:13 AM
I want to get rid of lvm. But I can't. Anaconda can't delete it or modify it. That's my problem.

stoat
24th November 2009, 11:51 AM
I want to reinstall Fedora but without lvm.

I want to get rid of lvm. But I can't. Anaconda can't delete it or modify it.Hello Diomedea,

If you want to delete the LVM physical volume leaving unpartitioned space, then XP can get rid of it with its Disk Management utility. You can also delete that system's ext3 boot partition with it.

P.S.: Always backup to an alternate medium everything important on every drive connected and running any time you do partition manipulation to cover yourself for accidents, wierdness, and unexpected results. They happen.

DBelton
24th November 2009, 09:25 PM
if you want to get rid of lvm completely, then you can grab the gparted iso, burn it to cd and boot from it, then remove the lvm partition.

you can get gparted here.. http://gparted.sourceforge.net/download.php

once you delete the lvm partition, then you can run your Fedora install and create your file system in the free space

SlowJet
24th November 2009, 09:36 PM
Anaconda (live or dvd) installer, disk screen, dropdown box, custom
click next

select any part of the partitioning you want, including LVM pars, for ad , edit, delete.

http://forums.fedoraforum.org/showthread.php?t=234621 - screenshots

SJ

Diomedea
25th November 2009, 09:53 PM
Ok here's the update: I tried to use stoat's solution. I tried to boot into the XP install cd. But I couldn't. It doesn't boot up. I entered in XP -> Autorun and then I tried to reinstall Win XP. Immediately a small window appeared telling me there is no file system so it can't install.

So there's no file system but I can use both XP and Fedora that are already installed. I just can't modify anything.

Aaaaaaaaaaaaaaaaaaaaaaaaaaa.....................

How can I repair the file system without loosing my data? I should mention that my XP system partition (c that is) is (or was?) ntfs.

stoat
25th November 2009, 10:01 PM
I tried to use stoat's solution. I tried to boot into the XP install cd. But I couldn't. It doesn't boot up.But I didn't mean to do that. I meant the Disk Management utility in your XP system.Control Panel => Administrative Tools => Computer Management => Disk ManagementThat thing will delete anything.



How can I repair the file system without loosing my data?Wait a minute now. What are you talking about now? I thought you wanted to completely delete (destroy) that LVM physical volume. That's what that XP Disk Management utility will do. It won't preserve any data. Be careful.

Diomedea
25th November 2009, 10:36 PM
You are right stoat. I wasn't clear enough.

On my hdd I have one Xp system partition, the Fedora "space" (default configuration) and two other partitions used for data storage. I don't want to loose the data in the XP and the two storage partitions. I wan't to erase the Fedora "space" and do an installation with a custom layout.

But since the file system is broken, I can't do that. By booting the XP install cd I wanted to try "fixmbr" thinking that this could fix the problem and also I want to try this: [http://www.winimage.com/bootpart.htm] as suggested here: [http://www.mjmwired.net/resources/mjm-fedora-f7.html#install], because I suspect that I messed up the file system when I reinstalled Grub as described at the start of this thread (that way probably not being the correct one)

stoat
25th November 2009, 10:53 PM
Okay, I thought XP was working. What is working now? I've read the first post a bunch of times, and it's still not clear to me yet. If XP is working, then its Disk Management utility can delete the unwanted Fedora partitions as already explained. If Fedora is working, then fdisk in Fedora will allow you to delete its own partitions while it is running. Did you know that? That's right. After you do it, it seems like nothing happened. The Fedora system will still be on your screen running, but it won't be there when you reboot. Now, if you do that and GRUB is your current boot loader, then that will be busted, of course. But with the Linux partitions gone, your XP CD should boot normally again and let you do your fixmbr thing to restore the master boot record to boot XP. Either way (delete the Fedora partitions with XP or Fedora), you should be left with XP and everything else that you did not delete.

Diomedea
26th November 2009, 07:19 PM
XP is working, Fedora is working, but:

-I can't boot up XP installation CD and when I try to run it from the existing XP it tells me that it doesn't find any file system so it can't start the installation

-when I boot up Fedora installation media it tells me that the HDD has a loop file system and that it needs to be reinitialised

-Fedora 10 was initially installed on the HDD; if I boot up Fedora 10 installation DVD and I click on "ignore" when I get the "reinitialize HDD" message I can install it in the Fedora "space" (the default layout, with LVM) but I can't edit that space (delete LVM for example)

-if I boot up some Fedora 11 installation media (CD or DVD) I can't install it in that Fedora "space"

-I read somewhere that in order for the XP installation CD to boot up it needs for the first partition to have a supported file system; the system monitor in Fedora tells me that C (which should be NTFS) is "fuseblk", and one partition that should be FAT32 is vfat

-C is the first partition on the HDD so the XP CD should boot up, but it doesn't so it must not recognize C as NTFS

In conclusion I have to recover the file system on C, but I don't know how.

I think I'll borrow an external HDD, transfer my data on it and reinitialize the HDD. I'll then install XP and Fedora but without Grub in the MBR. I just have to see how to find out if I have the BIOS 1024 cylinder limit (http://www.geocities.com/epark/linux/grub-w2k-HOWTO.html).

stoat
26th November 2009, 07:49 PM
XP is working...So what happens when you try to remove the unwanted Fedora partitions with XP's Disk Management utility? That is one thing you have never mentioned. If you were to do that, it's at least possible that Fedora 11 will install in the resulting unpartitioned space.

P.S.: Maybe I failed in my first explanation of what the Disk Management utility is in post #10 above. It's not on the XP CD. It's part of your now working XP system. It's in the Control Panel. It will delete anything.

Diomedea
26th November 2009, 07:58 PM
I already have F11. I installed through preupgrade, but the lvm remained ext3.

I mostly use Fedora so I don't want to take the risk. If I have time I'll try Disk Management before I reinitialize the HDD just to see what happens.

stoat
26th November 2009, 08:04 PM
I already have F11. I installed through preupgrade, but the lvm remained ext3.Okay. I don't understand anything going on here now. I sincerely apologize for not being able to understand. I will retreat now to prevent further unnecessary cluttering of your thread. Best wishes and good luck.

Diomedea
26th November 2009, 08:23 PM
I was able to install F11 with preupgrade, but when I tried to install it with the F11 Gnome live cd Anaconda said it couldn't.

I don't know why but this is what happened.

SlowJet
26th November 2009, 10:38 PM
Maybe because the preupgrade did not change the f/s type and it remained ext3,
but when you do another install, you must use the custom partitioning and disk druid to handle the existing partitions, formatting, /mounts.
Otherwise, the default is going to create a /boot ext4, and an LVM with LV for / ext4 and an LV for swap.
So you need to remove the partitions for linux and make disk freespace (as indicated by the Windows disk management tool) or use custom partitioning (5 choice on the dropdown list in the cd/dvd, clcik next) and then use disk druid.

The reasons the Live Gnome is complaining is because of the choice of partitioning and a possible error in 2,3,4 when partitions exits.

Think logically, use the custom. Everything about anaconda is an Install (disk freespace) or re-install (existing partitions - delete and reallocate or reuse by formatting, mounting, type change.)

The new release upgrade choice comes before any of these screens and if upgrade radio button is clicked on there is no partitiong occurring and the user never see any choices.

SJ

anaconda and dis druid screenshots.
http://forums.fedoraforum.org/showthread.php?t=234621

Diomedea
2nd December 2009, 05:14 PM
OK guys, I solved it.

I decided to see what GParted had to say about my HDD. So I installed it and it showed me that Fedora had set the "boot" flag to its /boot partition which in my case is a logical partition. This is probably why XP didn't recognize its "C" partition.

From what I read, I concluded that XP requires a lot of stuff:
-to be installed in a primary partition
-its "C" to have the "boot" flag
-its "C" to be the first partition

In my case "C" is sda1 (the first, primary, partition), but it was missing the boot flag.

I also concluded that Fedora install cd needs the "boot" flag to be set to a primary partition, because after I set/assigned it to sda1 (XP's "C") Anaconda didn't ask me to reinitialize the HDD anymore

After installing F12 I noticed that, again, the "boot" flag had been set to its /boot so I changed it back to sda1 (XP's "C") with GParted.

I think the "boot" flag problem might not have been the cause of the lvm removing problem. I think I didn't know how to do it at that time. You mustn't try to delete the lvm directly but rather delete one of its physical volumes (e.g. for Fedora's default layout - either "/" or the "swap" partition) and then the lvm will automatically be deleted too.

I didn't solve the XP installation CD boot problem though. I think it doesn't boot because Grub is in the MBR. However when trying to install from within the existing XP installation I was able to start the process - it didn't tell me that there was no file system anymore. So it wasn't that the file system was broken. It was just the fact that "C" (sda1) didn't have the "boot" flag. However I didn't take the installation to the end (because I decided not to reinstall XP, or al least not yet) so I don't know if it would succeed. If not I suppose I could run "fixmbr" from a floppy disk and then, the MBR being "fixed" (recognizable by XP) and sda1 having NTFS (a file system that XP recognizes), XP's installation CD should boot up. Then Grub should be reinstalled to MBR for F12 to be accessible again - this is why I think I'll try this (http://www.winimage.com/bootpart.htm) after I reinstall XP, solution that I found here (http://www.mjmwired.net/resources/mjm-fedora-f12.html#install) for those who need more details.