Linux Drive not formatted - help!
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 14 of 14
  1. #1
    Join Date
    Oct 2007
    Posts
    44

    HDD with LVM Partition - need to shrink/add/reformat partitons to add another OS

    Greetings:

    I've a Dual Boot, XP/Fedora 8 System; and tried to install Solaris. According to the Solaris install program (and confirmed by looking at gparted), turns out that with the exception of the boot partition, my Fedora drive is largely unformatted.

    I'd like to "reformat/relabel" the partition, so I can shrink it to install other OSes.

    I'm working on VirtualBox as well - can't call the Virtual Version of the XP Drive w/o the partition formatted either.

    Appreciate the help in advance.
    Last edited by robertgray86; 28th February 2008 at 02:10 AM.

  2. #2
    Join Date
    May 2004
    Location
    Central Wyoming
    Posts
    644
    You want to format a partition?

    Use fdisk -l to see how what kind of partition it is (ntfs, ext2, vfat, etc), then use mkfs -t <type> to format it to what it's labeled for.
    If it ain't broken - you're not really trying....
    Registered Linux user #227845

  3. #3
    Join Date
    Oct 2007
    Posts
    44

    More Details

    Greetings Zotter:

    If I format an existing drive, I'll wipe out the contents.

    Here's the problem in a nutshell:

    1) GParted can't tell what kind of file format my (non-boot) Fedora Partition
    has - pls see attachement.

    2) Fdisk tells me that I don't have valid partition tables
    <DIALOGUE>
    Disk /dev/sdb: 100.2 GB, 100256292864 bytes
    255 heads, 63 sectors/track, 12188 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x11a34bcc

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 25 200781 83 Linux
    /dev/sdb2 26 12188 97699297+ 8e Linux LVM

    Disk /dev/dm-0: 97.9 GB, 97911832576 bytes
    255 heads, 63 sectors/track, 11903 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x00000000

    Disk /dev/dm-0 doesn't contain a valid partition table

    Disk /dev/dm-1: 2080 MB, 2080374784 bytes
    255 heads, 63 sectors/track, 252 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x30307800

    Disk /dev/dm-1 doesn't contain a valid partition table
    </DIALOGUE>

    I'm no LVM expert - don't know if this is a botched install or expected for
    VirtualBox (unlikely).

    Nonetheless, I'd like to format and resize this drive so I can try out other OSs


    Thanks.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screenshot--dev-sdb - GParted.png 
Views:	143 
Size:	43.5 KB 
ID:	15233  

  4. #4
    Join Date
    Jun 2006
    Posts
    7,544
    Hello robertgray86,

    All of that is normal. GParted cannot perform any actions on LVM physical volumes and shows them as an unknown partition type. And I see that "Disk /dev/dm-0 doesn't contain a valid partition table" entry in every fdisk with LVM PVs. Search for some other fdisk results here and see what I mean. It's not hard to find dozens of examples.

    I imagine that Solaris installer has the same "problem" with LVM PVs showing them as unformatted, as you said.

    Shrinking the LVM PV to create space for more partitions is another matter. Your thread title probably did not attract the LVM experts (I don't use it). But that subject is discussed here all the time. You should be able to find lots of information in other threads related to shrinking LVM physical volumes.

    P.S.: Is anything wrong with your Fedora system?

  5. #5
    Join Date
    Oct 2007
    Posts
    44
    Thanks, Stoat:

    I'll try to edit the Original to attract the LVM experts.

    I've couple of bug reports out to redhat - thanks for asking.

  6. #6
    Join Date
    Jul 2007
    Location
    Virginia
    Posts
    252
    Robert,

    How much of the space of you current filesystem is used? Please post the results of df -h. Since you want to shrink your partition it is important that it is has some free space. Also, make sure you have a rescue disk handy. There is no way of shrinking a mounted filesystem, although you can expand one.

  7. #7
    Join Date
    Oct 2007
    Posts
    44
    Thanks GrapeShot:

    I've a liveCD handy; and have started backing up essential data. I read in another post about unmounting partitions first.

    Here's the df -h:
    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00
    90G 5.6G 85G 7% /
    /dev/sdb1 190M 34M 147M 19% /boot
    tmpfs 617M 12K 617M 1% /dev/shm
    /dev/sda1 39G 12G 27G 31% /mnt/WinXP

    As you can tell, I haven't used much of my Fedora Drive. I've resized partitions on XP, SuSE and Ubuntu in the past (usually during the install); but I was at a loss with the "LVM effect".

    If it can't be done, I can try Solaris on VirtualBox or wait until the Fedora 9 reinstall.

    Regards

  8. #8
    Join Date
    Jul 2007
    Location
    Virginia
    Posts
    252
    Robert,

    I just blew up my VM testing the resize proceedure. I should have it by tomorrow though.

    Later.

  9. #9
    Join Date
    Jul 2007
    Location
    Virginia
    Posts
    252
    Robert

    Here are the instructions that I said I would post. Mind you, this process may wipe out you swap partition (another one can be created) and you may also get a few errors on reboot, but you will end up with a new partition to load Solaris into.

    PLEASE BE CAREFUL. I HAVE ONLY DONE THIS A COUPLE OF TIMES AND YOU CAN REALLY MESS UP YOUR SYSTEM.

    1. reboot into rescue mode and DO NOT mount file systems. Choose skip when you get to that screen.

    2. The first step is to activate the logical volume that we plan on reducing. Since it appears that you have a default layout for Fedora8, go with /dev/VolGroup00/LogVol00. The -a y switch tells the rescue kernel to activate the Logical Volume.
    Code:
    # lvm lvchange /dev/VolGroup00/LogVol00 -a y
    3. Run e2fsck to make sure the file system is in good shape
    Code:
    # e2fsck -f /dev/VolGroup00/LogVol00
    4. Get some information on the current state of your LVs. Pay particular attention to the numbers for Current PE and LV Size. If your drives are like mine 1GB take up about 32 PEs (Physical Extents).
    Code:
    #l vm lvdisplay /dev/VolGroup00/LogVol00
    5. Now, resize the file system to the size that you desire, in this example, I chose 5GB
    Code:
    # resize2fs /dev/VolGroup00/LogVol00 5G
    6. Next, resize the Logical Volume. Using the formula of 1GB = 32 Extents (or whatever yours turned out to be) to figure out how much you want to reduce the LV by. For example, I wanted to reduce my LV by .69GB, so I would reduce it by 22 extents. The -l (Lowercase L) switch is to reduce (or enlarge +/-) the number of extents. -L would have changed the actual size in GB, MB, KB. I chose extents though.
    Code:
    # lvm lvresize /dev/VolGroup00/LogVol00 -l -22
    7. Now we resize the physical volume. I again used extents as the size measurement since I used them above except this time it should be what the original value was from step 4 above minus what we shrank the LV by in step 6.
    Code:
    # lvm pvresize --setphysicalvolumesize 120E
    8. Now use fdisk to delete the partition that holds the LVM. If you used the default layout it will be partition 2.

    9. Create a new partition for primary partition 2. Ensure that it is bigger than what you resized the physical volume to. I purposely give it about an extra GB just to make sure it is big enough. If it ends up being smaller, your system will most likely have a kernel panic and not boot at all. Ensure that you change the partition type to 8e for LVM.

    10. Create another partition from the left over space.

    11. Reboot

    Again, you may see some strange errors on booting. This is not something that is normally done - shrinking a LVM to create a partition. The most important part is to make sure that the resized partition is big enough to hold the resized files system. Also, pvresize will refuse to shrink if it has allocated extents after where its new end would be.

    If you do run into problems and your system will not boot, you can go into rescue mode and run the fdisk part again further increasing the size of the LVM partition.

    Good Luck, let me know how it turns out.

  10. #10
    Join Date
    Oct 2007
    Posts
    44
    Thank you, Grapeshot:

    Reviewed your response earlier today (should change my notification preferences - gomen); and gave it a few hours.

    I tried several times to resize and add partitions; but in the end, it cited an unexplained error and chose to stick to the "old tables".

    I may give it another shot tomorrow - after that, taking one's chances on installing FC9 (Alfa freezes today - Beta out in 10) may be an option for me. I could live with a glitchy install for a couple of days - such is life when a LiveCD is available.

    At least my system's intact. After this, I'm going to probably stay away from the LVM Concept for awhile.

    Best regards,


    Robert Gray

  11. #11
    Join Date
    Jul 2007
    Location
    Virginia
    Posts
    252
    Robert,

    No problem. I like the concept of LVM and being able to easily grow and shrink partitions. It seems to be more geared toward servers or systems with multiple hard drives. It is much easier to remove a drive/partition from a volume group and reclaim it for another purpose than to resize the only partition in the group. Maybe in the near future with (ext4?) it will allow for an easier way to resize LVMs.

    Later...

  12. #12
    Join Date
    Oct 2007
    Posts
    44
    Greetings, Everyone:

    I ended up reinstalling Fedora - this time with FC9 (figured it's close enough to the beta release date).

    Looks like in FC9, we're going to have to deal with LVM full time - I was unable to make a partition outside of it; and the only option I had was to let LVM take over the entire drive.

    Amature Hour Here - I tried to work around the LVM (consuming the entire drive) issue by establishing 2 Logical RAID partitions (obviously could not be placed after the LVM drive) during the setup - which did shrink the LVM Partiion; and managed to delete them to create unallocated "disk space" as well (per attachment).

    I WANTED to have the "/" and LVM arranged sequentially "upfront" of the drive, and the freespace near the end, so I can use the unused partitions to tack on Solaris and maybe another OS in the drive.

    Gparted won't let me move the partitions around (somehow I recall PartitionMagic being a bit more flexible; but I don't have it anymore)

    Perhaps this is only a cosmetic issue.

    Should I create new partitions from freepsace and install Solaris et all, or are there any fdisk expert commands (as in - change partition order) be appropriate for this?

    Pls advise - thanks.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screenshot--dev-sdb - GParted.png 
Views:	136 
Size:	40.7 KB 
ID:	15443  
    Last edited by robertgray86; 16th March 2008 at 11:55 PM.

  13. #13
    Join Date
    Jun 2006
    Posts
    7,544
    Quote Originally Posted by robertgray86

    I WANTED to have the "/" and LVM arranged sequentially "upfront" of the drive, and the freespace near the end, so I can use the unused partitions to tack on Solaris and maybe another OS in the drive.

    Gparted won't let me move the partitions around (somehow I recall PartitionMagic being a bit more flexible; but I don't have it anymore)

    Perhaps this is only a cosmetic issue.
    Hello again robertgray86,

    It is only a "cosmetic issue" when you look at the drive in a partition manager. And the reason is because it will function well the way it is, and it will not stop you from installing other systems in the unallocated space. FWIW I keep two Fedora systems entirely in logical partitions inside an extended partition at the "far end" of a drive just like your screenshot. I intentionally did that and like them there.

    P.S.: If you desire to have a root (/) partition outside of the LVM physical volume, why bother with LVM at all? Maybe that was a typo and you didn't mean that. Even so, I'm still wondering if the benefit of LVM is worth the agony it is causing in this case. After re-reading this thread from the beginning, I'm wondering if you realize that even though LVM is the default layout, it is still just an option. You can easily setup a system using standard ext2 or ext3 partitions. You can move, delete, or resize those kind of partitions to your heart's content with the usual partition managers. Nowadays, I install Fedora entirely on a single root partition. That may be on the fringe, but it works. It's simple. I can understand it. It's pretty in a partition manager.

    P.P.S.: I just thought of one thing related to my comment that your current layout will not stop you from installing other systems. That boot partition "up front" sometimes prevents an XP installation CD from booting. XP can be installed in any partition anywhere on a drive as long as there is a compatible active primary partition for its boot loader files. But apparently, sometimes, XP Setup gets upset when it "sees" certain partition layouts with Linux partitions. Your current layout is virtually guaranteed to cause it, but it can occur in other Linux partition layouts without a boot partition at the front. Anyway, if you ever decide to install XP on this computer, then you may have difficulty with the XP CD.
    Last edited by stoat; 17th March 2008 at 03:59 PM.

  14. #14
    Join Date
    May 2007
    Location
    U.S.
    Posts
    4,851
    Quote Originally Posted by robertgray86
    Looks like in FC9, we're going to have to deal with LVM full time
    I highly doubt that. The devs just probably haven't gone far enough in developing F9 to take a close look at the installer.

    If Fedora ever forces LVM on me... ugh. I won't say it.
    - Tom
    "What is freedom? To have the will to be responsible for one's self." - Stirner

Similar Threads

  1. Replies: 19
    Last Post: 8th December 2008, 12:17 PM
  2. external hard drive formatted??
    By fallstoofast in forum Hardware & Laptops
    Replies: 0
    Last Post: 25th May 2008, 04:18 PM
  3. Just formatted again...need to sort out hard drive
    By Greg A in forum Installation, Upgrades and Live Media
    Replies: 6
    Last Post: 7th January 2008, 08:36 PM
  4. Formatted Hard Drive/New Install
    By New Fedora User in forum Using Fedora
    Replies: 6
    Last Post: 22nd November 2006, 05:54 AM
  5. Replies: 6
    Last Post: 11th August 2005, 02:32 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •