Munged partition table - Setup

This is a discussion on Munged partition table - Setup ; I've got a system with two SATA drives, 1 160gb (OS, Fedora Core 6) and 1 500gb (backup, 2 250gb partitions). The OS disk I think would be /dev/sda and is also in a volume group / dev/mapper/VolGroup00-LogVol00. I don't ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Munged partition table

  1. Munged partition table

    I've got a system with two SATA drives, 1 160gb (OS, Fedora Core 6)
    and 1 500gb (backup, 2 250gb partitions).
    The OS disk I think would be /dev/sda and is also in a volume group /
    dev/mapper/VolGroup00-LogVol00. I don't know much how the VolumeGroup
    gets mapped to the disk. The backup drive is definitely /dev/sdb

    A colleague ran a script designed to be run on a system with ide
    drives, which ran an sfdisk (below) on /dev/sda anticipating it to
    really be a removable disk. The command ran without complaint on the
    mounted fs.
    sfdisk -q /dev/sda << EOF
    ,9,L
    ,2,L
    ,,L
    EOF

    An fdisk now looks like this:
    # fdisk -l /dev/sda

    Disk /dev/sda: 160.0 GB, 160000000000 bytes
    255 heads, 63 sectors/track, 19452 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 1 9 72292 83 Linux
    /dev/sda2 10 11 16065 83 Linux
    /dev/sda3 12 19452 156159832+ 83 Linux


    The box is still up, running without issue (I say this without knowing
    what it's done to a working fs) but I'm not sure how to proceed. I
    know the first two partitions are pretty small so perhaps it didn't
    get far into the disk. I don't know what the partition table looked
    like before hand.

    It was a standard FC6 install, and I can't even think what the
    partitions should be/would be. Is that all handled by the VolumeGroup?
    Obviously I'm a bit worried about having to reboot the system. Any
    advice would be much appreciated.

  2. Re: Munged partition table

    On Thu, 31 Jul 2008 21:21:58 -0400, jonneh wrote:

    > The box is still up, running without issue (I say this without knowing
    > what it's done to a working fs) but I'm not sure how to proceed. I
    > know the first two partitions are pretty small so perhaps it didn't
    > get far into the disk. I don't know what the partition table looked
    > like before hand.
    > It was a standard FC6 install, and I can't even think what the
    > partitions should be/would be. Is that all handled by the VolumeGroup?
    > Obviously I'm a bit worried about having to reboot the system. Any
    > advice would be much appreciated.


    OUCH!. Don't let that system shutdown, unless you've got a boot cd/dvd,
    with partition/mbr editing tools.

    Also avoid running anything like pvscan, or any other lvm utilities,
    and do not unmount anything.

    I'm running Mandriva, also using LVM, although on IDE. On my system,
    part of what I have is ...
    [root@hodgins blkid]# sfdisk -l -uS /dev/hda

    Disk /dev/hda: 60801 cylinders, 255 heads, 63 sectors/track
    Units = sectors of 512 bytes, counting from 0

    Device Boot Start End #sectors Id System
    /dev/hda1 * 63 4000184 4000122 b W95 FAT32
    /dev/hda2 4000185 976768064 972767880 5 Extended
    /dev/hda3 0 - 0 0 Empty
    /dev/hda4 0 - 0 0 Empty
    /dev/hda5 4000248 8000369 4000122 b W95 FAT32
    /dev/hda6 8000433 12000554 4000122 b W95 FAT32
    /dev/hda7 12000618 16000739 4000122 b W95 FAT32
    /dev/hda8 16000803 18089189 2088387 83 Linux
    /dev/hda9 18089253 286519274 268430022 8e Linux LVM
    /dev/hda10 286519338 292800689 6281352 82 Linux swap / Solaris

    I expect you'd have at least a linux partition for root, a swap partition,
    and the partiton containing the LVM physical volume, and possibly an
    extended partition, which could contain any of the above, as logical
    partitions.

    "cat /proc/partitions" will give you the names and number of sectors, of all
    of the partitions.

    cat /sys/block/sda/sda1/start will give you the starting sector.
    Repeat this for each partition.

    Use "mount |grep /dev/sd" for any mounted regular partitions, to confirm
    the partiton fstype.
    Use "swapon -s" to confirm which (if any) partitons are swap partitions.
    "grep /dev/sd /etc/lvm/backup/* should show lvm physical volume partitions.

    Once you have the list of partitions, with the fstype, start sector, and the
    number of blocks, post back, for help with the format of the sfdisk command,
    to fix it.

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

  3. Re: Munged partition table

    On Jul 31, 10:38 pm, "David W. Hodgins"
    wrote:
    > OUCH!. Don't let that system shutdown, unless you've got a boot cd/dvd,
    > with partition/mbr editing tools.
    >
    > Also avoid running anything like pvscan, or any other lvm utilities,
    > and do not unmount anything.
    >
    > I'm running Mandriva, also using LVM, although on IDE. On my system,
    > part of what I have is ...
    > [root@hodgins blkid]# sfdisk -l -uS /dev/hda
    >
    > Disk /dev/hda: 60801 cylinders, 255 heads, 63 sectors/track
    > Units = sectors of 512 bytes, counting from 0
    >
    > Device Boot Start End #sectors Id System
    > /dev/hda1 * 63 4000184 4000122 b W95 FAT32
    > /dev/hda2 4000185 976768064 972767880 5 Extended
    > /dev/hda3 0 - 0 0 Empty
    > /dev/hda4 0 - 0 0 Empty
    > /dev/hda5 4000248 8000369 4000122 b W95 FAT32
    > /dev/hda6 8000433 12000554 4000122 b W95 FAT32
    > /dev/hda7 12000618 16000739 4000122 b W95 FAT32
    > /dev/hda8 16000803 18089189 2088387 83 Linux
    > /dev/hda9 18089253 286519274 268430022 8e Linux LVM
    > /dev/hda10 286519338 292800689 6281352 82 Linux swap / Solaris
    >
    > I expect you'd have at least a linux partition for root, a swap partition,
    > and the partiton containing the LVM physical volume, and possibly an
    > extended partition, which could contain any of the above, as logical
    > partitions.
    >
    > "cat /proc/partitions" will give you the names and number of sectors, of all
    > of the partitions.
    >
    > cat /sys/block/sda/sda1/start will give you the starting sector.
    > Repeat this for each partition.
    >
    > Use "mount |grep /dev/sd" for any mounted regular partitions, to confirm
    > the partiton fstype.
    > Use "swapon -s" to confirm which (if any) partitons are swap partitions.
    > "grep /dev/sd /etc/lvm/backup/* should show lvm physical volume partitions.
    >
    > Once you have the list of partitions, with the fstype, start sector, and the
    > number of blocks, post back, for help with the format of the sfdisk command,
    > to fix it.
    >
    > Regards, Dave Hodgins
    >
    > --
    > Change nomail.afraid.org to ody.ca to reply by email.
    > (nomail.afraid.org has been set up specifically for
    > use in usenet. Feel free to use it yourself.)


    Dave, wow! Thanks for the great info on that. I'm feeling a bit (just
    a bit) better about being able to get out of the situation.
    I've run through the places you mentioned above and it doesn't look
    like I've pulled any fstypes from the 'old' partition table. I could
    guess that sda2 is 2gb of swap or thereabouts and sda5 is the main
    ext3 fs.

    Here's some info (I left out the info from disks other than /dev/sda)

    This is the current sfdisk with the 'bad' partitions.
    # sfdisk -l -uS /dev/sda

    Disk /dev/sda: 19452 cylinders, 255 heads, 63 sectors/track
    Units = sectors of 512 bytes, counting from 0

    Device Boot Start End #sectors Id System
    /dev/sda1 1 144584 144584 83 Linux
    /dev/sda2 144585 176714 32130 83 Linux
    /dev/sda3 176715 312496379 312319665 83 Linux
    /dev/sda4 0 - 0 0 Empty


    # cat /proc/partitions
    major minor #blocks name

    8 0 156250000 sda
    8 1 56196 sda1
    8 2 2104515 sda2
    8 3 104422 sda3
    8 4 1 sda4
    8 5 153982993 sda5

    From /sys/block/sda/
    partition start size
    /dev/sda1 63 112392
    /dev/sda2 112455 4209030
    /dev/sda3 4321485 208845
    /dev/sda4 4530330 2
    /dev/sda5 4530393 307965987

    Nothing shows up for sda under "mount | grep /dev/sd"

    # swapon -s
    Filename Type Size
    Used Priority
    /dev/mapper/VolGroup00-LogVol01 partition 2031608
    164 -1

    # grep /dev/sd /etc/lvm/backup/*
    device = "/dev/sda5" # Hint only

  4. Re: Munged partition table

    On Fri, 01 Aug 2008 16:26:21 -0400, jonneh wrote:

    > From /sys/block/sda/
    > partition start size
    > /dev/sda1 63 112392
    > /dev/sda2 112455 4209030
    > /dev/sda3 4321485 208845
    > /dev/sda4 4530330 2
    > /dev/sda5 4530393 307965987


    sda4 is obviously the extended partition (type 5). We know that sda5 is the
    lvm physical volume, which should be type 8e.

    Your swap is on a lvm logical volume, so we don't currently know what the
    fstype should be for sda1, 2, and 3.

    Try running "/sbin/vol_id /dev/sda1", to see if it finds the fstype. Same
    for sda2 and 3. I'm not sure if vol_id will use /sys/block, or the actual
    partition table. Unlike pvscan, it won't hurt to try it, as it doesn't
    update any config files, etc.

    I've used "sfdisk -d /dev/hdb > sfdisk.txt to create an input file for
    sfdisk, and modified it with the info from above. Note that the start
    and size are in sectors.

    ============ cut here and save as sfdisk.txt ==================
    # partition table of /dev/sda
    unit: sectors

    /dev/sda1 : start= 63, size= 112392, Id=??, bootable
    /dev/sda2 : start= 112455, size= 4209030, Id=??
    /dev/sda3 : start= 4321485, size= 208845, Id=??
    /dev/sda4 : start= 4530330, size= 2, Id= 5
    /dev/sda5 : start= 4530393, size=307965987, Id=8e
    ============ cut here and save as sfdisk.txt ==================

    Once you've modified the id for sda1, 2, and 3, save the above
    as sfdisk.txt, and then run "sfdisk /dev/sda < sfdisk.txt" Note
    that running "sfdisk -T" will show you the id codes for all of the
    file system types.

    As a precaution, after running the sfdisk, reinstall lilo or grub,
    before trying to reboot.

    Back up everything before rebooting. Also make sure you have a bootable
    install cd/dvd handy, just in case .

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

  5. Re: Munged partition table

    On Fri, 01 Aug 2008 16:26:21 -0400, jonneh wrote:

    > Dave, wow! Thanks for the great info on that. I'm feeling a bit (just
    > a bit) better about being able to get out of the situation.


    It's been a while. Did it work?

    Regards, Dave Hodgins

    --
    Change nomail.afraid.org to ody.ca to reply by email.
    (nomail.afraid.org has been set up specifically for
    use in usenet. Feel free to use it yourself.)

+ Reply to Thread