Re: Blew away my partition table

2010-07-04 Thread J. Epperson
On Wed, June 30, 2010 09:31, J. Epperson wrote:
> On Tue, June 29, 2010 22:16, Jefferson Ogata wrote:
>> On 2010-06-30 01:53, J. Epperson wrote:
>>> On Tue, June 29, 2010 21:27, Jefferson Ogata wrote:
> Number  Start   End SizeType File system
> Flags 1  63s 401622s 401560s primary  ext3
> boot 2  401625s 139299608s  138897984s  primary  ext3 3
> 139299616s  143380124s  4080509sprimary   swap
 I would say those end sectors on partitions 1 and 2 should be one
 less than the following partition's start sector. The end sector of
  partition 3 looks correct; though the last sector on the disk is
 143380479, when you round down to a cylinder boundary you end up at
  143380124.
>>>
>>> I was thinking the same thing, but that's what the parted rescue
>>> "found", so I assumed it was correct.  Looking at another F12 system,
>>>  what you say is how that one is.  Not sure what to do, try it as is
>>> or make the adjustment.  I do notice from the other system that I
>>> should probably mark the swap as FS type linux-swap(v1).  The other
>>> system looks like:
>>
>> I don't think it would actually matter with partition 1. If your
>> filesystem has a 2kB or 4kB block size, then those extra 2 sectors
>> won't ever be addressed. With partition 2, however, the additional 7
>> sectors extend the volume by one or two filesystem blocks (with 3 extra
>> sectors on the end).
>>
>> I would go ahead and extend the partitions to the n-1 values. It's
>> always safe to have a filesystem on a block device that is larger than
>> the filesystem, but the converse is not true. You can also check the
>> superblock with tune2fs -l to see how big the filesytem thinks the
>> block device is. "Block count" * "Block size" / 512 should be <= the
>> number of sectors.
>>
>
> I understand and will take that advice.  Hilariously, although gparted
> blithely let me blow away the previous partition table without a whimper
> and parted let me build a new one with the partitions mounted, parted now
>  refuses to let me adjust the partition end points because they are
> mounted.  I suppose I could blow the whole thing away again and redo from
>  scratch, but I think I'm going to boot rescue and do with it with them
> not mounted.
>
>

Just got around to doing the live boot and making the adjustments
suggested by Jefferson Ogata.  I ended up removing the partitions and
adding back with correct end points rather than using "move" in parted. 
All is well.

I did have to manually redo swap after reboot with:
mkswap -c -U /dev/sda3
with uuid gleaned from /etc/fstab.

Thanks to all who offered help, and particularly to Jefferson Ogata and to
Bond Masuda.  Happy Fourth of July.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-30 Thread J. Epperson
On Tue, June 29, 2010 22:16, Jefferson Ogata wrote:
> On 2010-06-30 01:53, J. Epperson wrote:
>> On Tue, June 29, 2010 21:27, Jefferson Ogata wrote:
 Number  Start   End SizeType File system
 Flags 1  63s 401622s 401560s primary  ext3
 boot 2  401625s 139299608s  138897984s  primary  ext3 3
 139299616s  143380124s  4080509sprimary   swap
>>> I would say those end sectors on partitions 1 and 2 should be one
>>> less than the following partition's start sector. The end sector of
>>> partition 3 looks correct; though the last sector on the disk is
>>> 143380479, when you round down to a cylinder boundary you end up at
>>> 143380124.
>>
>> I was thinking the same thing, but that's what the parted rescue
>> "found", so I assumed it was correct.  Looking at another F12 system,
>> what you say is how that one is.  Not sure what to do, try it as is or
>> make the adjustment.  I do notice from the other system that I should
>> probably mark the swap as FS type linux-swap(v1).  The other system
>> looks like:
>
> I don't think it would actually matter with partition 1. If your
> filesystem has a 2kB or 4kB block size, then those extra 2 sectors won't
> ever be addressed. With partition 2, however, the additional 7 sectors
> extend the volume by one or two filesystem blocks (with 3 extra sectors
> on the end).
>
> I would go ahead and extend the partitions to the n-1 values. It's always
> safe to have a filesystem on a block device that is larger than the
> filesystem, but the converse is not true. You can also check the
> superblock with tune2fs -l to see how big the filesytem thinks the block
> device is. "Block count" * "Block size" / 512 should be <= the number of
> sectors.
>

I understand and will take that advice.  Hilariously, although gparted
blithely let me blow away the previous partition table without a whimper
and parted let me build a new one with the partitions mounted, parted now
refuses to let me adjust the partition end points because they are
mounted.  I suppose I could blow the whole thing away again and redo from
scratch, but I think I'm going to boot rescue and do with it with them not
mounted.


___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Jefferson Ogata
On 2010-06-30 01:53, J. Epperson wrote:
> On Tue, June 29, 2010 21:27, Jefferson Ogata wrote:
>>> Number  Start   End SizeType File system  Flags
>>>  1  63s 401622s 401560s primary  ext3 boot
>>>  2  401625s 139299608s  138897984s  primary  ext3
>>>  3  139299616s  143380124s  4080509sprimary   swap
>> I would say those end sectors on partitions 1 and 2 should be one less
>> than the following partition's start sector. The end sector of partition
>> 3 looks correct; though the last sector on the disk is 143380479, when
>> you round down to a cylinder boundary you end up at 143380124.
> 
> I was thinking the same thing, but that's what the parted rescue "found",
> so I assumed it was correct.  Looking at another F12 system, what you say
> is how that one is.  Not sure what to do, try it as is or make the
> adjustment.  I do notice from the other system that I should probably mark
> the swap as FS type linux-swap(v1).  The other system looks like:

I don't think it would actually matter with partition 1. If your 
filesystem has a 2kB or 4kB block size, then those extra 2 sectors won't 
ever be addressed. With partition 2, however, the additional 7 sectors 
extend the volume by one or two filesystem blocks (with 3 extra sectors 
on the end).

I would go ahead and extend the partitions to the n-1 values. It's 
always safe to have a filesystem on a block device that is larger than 
the filesystem, but the converse is not true. You can also check the 
superblock with tune2fs -l to see how big the filesytem thinks the block 
device is. "Block count" * "Block size" / 512 should be <= the number of 
sectors.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread J. Epperson
On Tue, June 29, 2010 21:27, Jefferson Ogata wrote:
> On 2010-06-30 01:13, J. Epperson wrote:
>> I read your posts regularly, and learn from you often.  Does the rest of
>> it look right, or at least plausible?
>
> Gee, thanks. :^)

Thank _you_.  Sincerely intended, from a 25 year systems engineer.

>
> Mostly looks plausible. But:
>
>> Model: MegaRAID LD 0 RAID1 70G (scsi)
>> Disk /dev/sda: 143380480s
>> Sector size (logical/physical): 512B/512B
>> Partition Table: msdos
>>
>> Number  Start   End SizeType File system  Flags
>>  1  63s 401622s 401560s primary  ext3 boot
>>  2  401625s 139299608s  138897984s  primary  ext3
>>  3  139299616s  143380124s  4080509sprimary   swap
>
> I would say those end sectors on partitions 1 and 2 should be one less
> than the following partition's start sector. The end sector of partition
> 3 looks correct; though the last sector on the disk is 143380479, when
> you round down to a cylinder boundary you end up at 143380124.
>

I was thinking the same thing, but that's what the parted rescue "found",
so I assumed it was correct.  Looking at another F12 system, what you say
is how that one is.  Not sure what to do, try it as is or make the
adjustment.  I do notice from the other system that I should probably mark
the swap as FS type linux-swap(v1).  The other system looks like:

Model: ATA ST3500410AS (scsi)
Disk /dev/sda: 976773168s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End SizeType File system Flags
 1  63s 401624s 401562s primary  ext3boot
 2  401625s 958743134s  958341510s  primary  ext3
 3  958743135s  976751999s  18008865s   primary  linux-swap(v1)  swap


___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Jefferson Ogata
On 2010-06-30 01:13, J. Epperson wrote:
> I read your posts regularly, and learn from you often.  Does the rest of
> it look right, or at least plausible?

Gee, thanks. :^)

Mostly looks plausible. But:

> Model: MegaRAID LD 0 RAID1 70G (scsi)
> Disk /dev/sda: 143380480s
> Sector size (logical/physical): 512B/512B
> Partition Table: msdos
> 
> Number  Start   End SizeType File system  Flags
>  1  63s 401622s 401560s primary  ext3 boot
>  2  401625s 139299608s  138897984s  primary  ext3
>  3  139299616s  143380124s  4080509sprimary   swap

I would say those end sectors on partitions 1 and 2 should be one less 
than the following partition's start sector. The end sector of partition 
3 looks correct; though the last sector on the disk is 143380479, when 
you round down to a cylinder boundary you end up at 143380124.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread J. Epperson
On Tue, June 29, 2010 21:01, Jefferson Ogata wrote:
> On 2010-06-30 00:54, J. Epperson wrote:
>> Still have to do a grub-install /dev/sda (probably after booting
>> rescue). I won't get around to testing this on a reboot for a day or
>> two, need to wait until I know I'll have time to restore from an image
>> I took a few months ago and reload from rsync if I didn't get it right.
>>
>
> Not sure you'll need the grub-install. I don't know why the MBR would be
> harmed.
>

I read your posts regularly, and learn from you often.  Does the rest of
it look right, or at least plausible?

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Jefferson Ogata
On 2010-06-30 00:54, J. Epperson wrote:
> Still have to do a grub-install /dev/sda (probably after booting rescue). 
> I won't get around to testing this on a reboot for a day or two, need to
> wait until I know I'll have time to restore from an image I took a few
> months ago and reload from rsync if I didn't get it right.

Not sure you'll need the grub-install. I don't know why the MBR would be 
harmed.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread J. Epperson
On Tue, June 29, 2010 19:59, Ray Van Dolson wrote:
> On Tue, Jun 29, 2010 at 04:54:11PM -0700, J. Epperson wrote:
>> Thanks to all for the input, and particularly to Bond for getting me
>> thinking about the kernel data on disks in /proc and /sys, since the
>> kernel doesn't know about the mishap yet.  I got the start sectors
>> and sizes out of /sys/block/sda/sda* and I think I'll get the table
>> restored with parted's rescue command.  I should be able to reset the
>> MBR with grub-install.
>
> If you've taken notes, would be nice to reply back here with your
> procedure.
>
> Ray
>

Here's what it looks like so far.  For those who missed the trim, I
stupidly overwrote the /dev/sda partition table with a blank one.

Get the partition starts and sizes from /sys/block/sda/sda*.  Handy query:
grep . /sys/block/sda/sda*/{start,size}
Start parted for /dev/sda, change units to sectors:
u s
Then start rescuing using start and end=start+(size - 1):
rescue 63 401624
was my command for /dev/sda1 (/boot).
After rescuing, set boot flag on sda1:
set 1 boot on
Continue rescuing other partitions.

It found /boot and / ok, didn't recognize swap as a partition for sda3,
but I made that manually and it shouldn't matter if the size is off a few
sectors (the start-end of what it found for sda1 and sda2 didn't match
calculations for start-end, was off by -2 on sda1, by -6 on sda2).  I used
parted command:
mkpart primary linux-swap 139299616 143380124

Still have to do a grub-install /dev/sda (probably after booting rescue). 
I won't get around to testing this on a reboot for a day or two, need to
wait until I know I'll have time to restore from an image I took a few
months ago and reload from rsync if I didn't get it right.

Right now it looks like:
(parted) p
Model: MegaRAID LD 0 RAID1 70G (scsi)
Disk /dev/sda: 143380480s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End SizeType File system  Flags
 1  63s 401622s 401560s primary  ext3 boot
 2  401625s 139299608s  138897984s  primary  ext3
 3  139299616s  143380124s  4080509sprimary   swap

or in default units:

Model: MegaRAID LD 0 RAID1 70G (scsi)
Disk /dev/sda: 73.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End SizeType File system  Flags
 1  32.3kB  206MB   206MB   primary  ext3 boot
 2  206MB   71.3GB  71.1GB  primary  ext3
 3  71.3GB  73.4GB  2089MB  primary   swap


The /proc/partitions and /sys/block/sda dumps looked like:

[r...@server ~]# cat /proc/partitions
major minor  #blocks  name

   80   71690240 sda
   81 200781 sda1
   82   69448995 sda2
   832040255 sda3
   8   16  488386584 sdb
   8   17  488384001 sdb1

[r...@server ~]# grep . /sys/block/sda/sda*/{start,size}
/sys/block/sda/sda1/start:63
/sys/block/sda/sda2/start:401625
/sys/block/sda/sda3/start:139299615
/sys/block/sda/sda1/size:401562
/sys/block/sda/sda2/size:138897990
/sys/block/sda/sda3/size:4080510

Will post back on final results.  Oh, this is a Fedora 12 system, mostly
sendmail, imap, and httpd, on an ancient Precision 530 with a PERC3.

Thanks again.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Ray Van Dolson
On Tue, Jun 29, 2010 at 04:54:11PM -0700, J. Epperson wrote:
> Thanks to all for the input, and particularly to Bond for getting me
> thinking about the kernel data on disks in /proc and /sys, since the
> kernel doesn't know about the mishap yet.  I got the start sectors
> and sizes out of /sys/block/sda/sda* and I think I'll get the table
> restored with parted's rescue command.  I should be able to reset the
> MBR with grub-install.

If you've taken notes, would be nice to reply back here with your
procedure.

Ray

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread J. Epperson
Thanks to all for the input, and particularly to Bond for getting me
thinking about the kernel data on disks in /proc and /sys, since the
kernel doesn't know about the mishap yet.  I got the start sectors and
sizes out of /sys/block/sda/sda* and I think I'll get the table restored
with parted's rescue command.  I should be able to reset the MBR with
grub-install.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Support @ Technologist.si
Hi there,
I would also go for testdisk if you want to keep it simple... 
it's included in most repositories of most linux distri.

I normally use it to recover "broken" fat32 and ntfs disks, but 1 time
also ext3.. works like a charm..

Sleep well and Good luck anyway,

arno

Op dinsdag 29-06-2010 om 14:27 uur [tijdzone -0600], schreef Stephen
Dowdy:
> Jefferson Ogata wrote, On 06/29/2010 02:06 PM:
>  > Lots of really good info ...
> 
> Also, take a look at :
> 
> http://www.cgsecurity.org/wiki/TestDisk
> -
> TestDisk can
> 
> * Fix partition table, recover deleted partition
> * Recover FAT32 boot sector from its backup
> * Rebuild FAT12/FAT16/FAT32 boot sector
> * Fix FAT tables
> * Rebuild NTFS boot sector
> * Recover NTFS boot sector from its backup
> * Fix MFT using MFT mirror
> * Locate ext2/ext3 Backup SuperBlock
> * Undelete files from FAT, NTFS and ext2 filesystem
> * Copy files from deleted FAT, NTFS and ext2/ext3 partitions. 
> -
> 
> I'm not sure if there's a simple command to scan the device,
> presuming only the partition table is borked and to recreate
> just the PT, but i think so.  At least it can do Superblock
> scan lookups.
> 
> There's another tool i've run across that'll scan a block dev
> for superblock backups, but i can't recall the name...
> 
> btw, cgsecurity has "photorec", which was originally designed
> to recover lost photos off digital camera media.  It's been
> enhanced to recover a large number of file types off any
> damaged media and write what it can to auxiliary storage.
> 
> 
> --stephen
> 


___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Jefferson Ogata
On 2010-06-29 20:22, Eberhard Moenkeberg wrote:
> On Tue, 29 Jun 2010, Jefferson Ogata wrote:
>> You should be able to use dmsetup to create device nodes with offset
>> into /dev/sda if you want to do this. But you should be able to find
>> your filesystem headers with dd and xxd (or any hexdump program).
> 
> A very good idea, to avoid the reboot.

Well, apparently using dmsetup doesn't work because the kernel refuses 
to set up new mappings directly on /dev/sda, possibly because there's an 
existing lock on the device due to the partition table being loaded.

>> Where to look:
>>
>> - The first partition starts one track into the disk; typically that's
>> 63 512-byte sectors.
>>
>> - The second, third, and fourth partitions are usually on cylinder
>> boundaries, with a cylinder typically being 63 * 255 512-byte sectors.
>>
>> - If you had more than four partitions, then the last physical partition
>> has a partition table at the beginning. The first logical partition will
>> begin one track into that physical partition.
>>
>> What to look for:
>>
>> - For ext3 filesystems, a superblock begins 1024 bytes into the
>> partition. At offset 0x38 in the superblock you should find the magic
>> number 0x53ef (big-endian).
>>
>> - For swap partitions, look at the first 4096 bytes. At the end of that
>> page you should find the string SWAPSPACE2.
>>
>> - For LVM physical volumes you should see an LVM label 512 bytes from
>> the beginning of the partition.
> 
> A nice collection. Thanks, I will keep it in case i get into partition 
> table trouble.

A little more info:

- For ext3 filesystems, the superblock begins with a series of uint32_ts 
in little-endian format. The second uint32_t is the number of filesystem 
blocks in the filesystem. The seventh uint32_t is the block size, 
expressed as the number of bits to shift 1024 left. (So 0 for 1024-byte 
blocks, 1 for 2048-byte blocks, 2 for 4096-byte blocks). From this you 
can calculate the offset to the next partition--multiply the number of 
blocks by the actual blocksize and round up to a cylinder boundary.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Stephen Dowdy
Jefferson Ogata wrote, On 06/29/2010 02:06 PM:
 > Lots of really good info ...

Also, take a look at :

http://www.cgsecurity.org/wiki/TestDisk
-
TestDisk can

* Fix partition table, recover deleted partition
* Recover FAT32 boot sector from its backup
* Rebuild FAT12/FAT16/FAT32 boot sector
* Fix FAT tables
* Rebuild NTFS boot sector
* Recover NTFS boot sector from its backup
* Fix MFT using MFT mirror
* Locate ext2/ext3 Backup SuperBlock
* Undelete files from FAT, NTFS and ext2 filesystem
* Copy files from deleted FAT, NTFS and ext2/ext3 partitions. 
-

I'm not sure if there's a simple command to scan the device,
presuming only the partition table is borked and to recreate
just the PT, but i think so.  At least it can do Superblock
scan lookups.

There's another tool i've run across that'll scan a block dev
for superblock backups, but i can't recall the name...

btw, cgsecurity has "photorec", which was originally designed
to recover lost photos off digital camera media.  It's been
enhanced to recover a large number of file types off any
damaged media and write what it can to auxiliary storage.


--stephen

-- 
Stephen Dowdy  -  Systems Administrator  -  NCAR/RAL
303.497.2869   -  sdo...@ucar.edu-  http://www.ral.ucar.edu/~sdowdy/

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Eberhard Moenkeberg
Hi,

On Tue, 29 Jun 2010, Jefferson Ogata wrote:
> On 2010-06-29 19:44, Eberhard Moenkeberg wrote:
>> On Tue, 29 Jun 2010, J. Epperson wrote:

>>> Arrived home very tired and in a lapse of judgement tried to configure a
>>> new USB backup drive on my PERC3 based home server, with a new cat roaming
>>> between me and the monitor.  Created a new partition on the existing
>>> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
>>> doing an rsync to the new drive now.
>>>
>>> Can some kind soul help me remember how to repair this surgically instead
>>> of rebuilding the filesystem and reloading it?  If not, I deserve it.
>>
>> You just need to revert the partition table change.
>> If you do not have a backup of the master boot record (LILO would have
>> one), you can use the df output to estimate the right cylinder numbers.
>
> /proc/partitions is possibly a better reference.
>
>> If you need trial and error to find the boundaries, "tune2fs -l /dev/sdaX"
>> is a non-destructive test.
>
> Doubtful that will work; it will refer to the old partition table the
> kernel is still using.

Yes, it works only after reboot.

> You should be able to use dmsetup to create device nodes with offset
> into /dev/sda if you want to do this. But you should be able to find
> your filesystem headers with dd and xxd (or any hexdump program).

A very good idea, to avoid the reboot.

> Where to look:
>
> - The first partition starts one track into the disk; typically that's
> 63 512-byte sectors.
>
> - The second, third, and fourth partitions are usually on cylinder
> boundaries, with a cylinder typically being 63 * 255 512-byte sectors.
>
> - If you had more than four partitions, then the last physical partition
> has a partition table at the beginning. The first logical partition will
> begin one track into that physical partition.
>
> What to look for:
>
> - For ext3 filesystems, a superblock begins 1024 bytes into the
> partition. At offset 0x38 in the superblock you should find the magic
> number 0x53ef (big-endian).
>
> - For swap partitions, look at the first 4096 bytes. At the end of that
> page you should find the string SWAPSPACE2.
>
> - For LVM physical volumes you should see an LVM label 512 bytes from
> the beginning of the partition.

A nice collection. Thanks, I will keep it in case i get into partition 
table trouble.


Viele Gruesse
Eberhard Moenkeberg (emoe...@gwdg.de, e...@kki.org)

-- 
Eberhard Moenkeberg
Arbeitsgruppe IT-Infrastruktur
E-Mail: emoe...@gwdg.de  Tel.: +49 (0)551 201-1551
-
Gesellschaft fuer wissenschaftliche Datenverarbeitung mbH Goettingen (GWDG)
Am Fassberg 11, 37077 Goettingen
URL:http://www.gwdg.de E-Mail: g...@gwdg.de
Tel.:   +49 (0)551 201-1510Fax:+49 (0)551 201-2150
Geschaeftsfuehrer:   Prof. Dr. Bernhard Neumair
Aufsichtsratsvorsitzender: Dipl.-Kfm. Markus Hoppe
Sitz der Gesellschaft: Goettingen
Registergericht:   Goettingen  Handelsregister-Nr. B 598
-

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Jefferson Ogata
On 2010-06-29 19:44, Eberhard Moenkeberg wrote:
> On Tue, 29 Jun 2010, J. Epperson wrote:
>> Arrived home very tired and in a lapse of judgement tried to configure a
>> new USB backup drive on my PERC3 based home server, with a new cat roaming
>> between me and the monitor.  Created a new partition on the existing
>> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
>> doing an rsync to the new drive now.
>>
>> Can some kind soul help me remember how to repair this surgically instead
>> of rebuilding the filesystem and reloading it?  If not, I deserve it.
> 
> You just need to revert the partition table change.
> If you do not have a backup of the master boot record (LILO would have 
> one), you can use the df output to estimate the right cylinder numbers.

/proc/partitions is possibly a better reference.

> If you need trial and error to find the boundaries, "tune2fs -l /dev/sdaX" 
> is a non-destructive test.

Doubtful that will work; it will refer to the old partition table the 
kernel is still using.

You should be able to use dmsetup to create device nodes with offset 
into /dev/sda if you want to do this. But you should be able to find 
your filesystem headers with dd and xxd (or any hexdump program).

Where to look:

- The first partition starts one track into the disk; typically that's 
63 512-byte sectors.

- The second, third, and fourth partitions are usually on cylinder 
boundaries, with a cylinder typically being 63 * 255 512-byte sectors.

- If you had more than four partitions, then the last physical partition 
has a partition table at the beginning. The first logical partition will 
begin one track into that physical partition.

What to look for:

- For ext3 filesystems, a superblock begins 1024 bytes into the 
partition. At offset 0x38 in the superblock you should find the magic 
number 0x53ef (big-endian).

- For swap partitions, look at the first 4096 bytes. At the end of that 
page you should find the string SWAPSPACE2.

- For LVM physical volumes you should see an LVM label 512 bytes from 
the beginning of the partition.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread J. Epperson
On Tue, June 29, 2010 15:39, Ray Van Dolson wrote:
> On Tue, Jun 29, 2010 at 12:32:02PM -0700, J. Epperson wrote:
>> Arrived home very tired and in a lapse of judgement tried to configure
>> a new USB backup drive on my PERC3 based home server, with a new cat
>> roaming between me and the monitor.  Created a new partition on the
>> existing /dev/sda instead of the new /dev/sdb.  System is still
>> running, and I"m doing an rsync to the new drive now.
>>
>> Can some kind soul help me remember how to repair this surgically
>> instead of rebuilding the filesystem and reloading it?  If not, I
>> deserve it.
>
> If you know exactly how the previous partitions were laid out, you can
> just recreate that structure.
>
> The underlying filesystem data will be fine.
>
> I'm sure there's a way to glean the partition structure information from
> the layout of data on your disk as well... especially if it was fairly
> simple (ie, /boot as ext2 and / as ext3 or LVM).
>

Thanks. If I get some rest I may be able to think through it.  It was a
stock /boot on sda1 and / on sda2, with swap on sda3, no lvols, no other
partitions.  I have a df so I know the sizes, but not sure I'm capable of
translating that to what I need to do with parted/gparted to line the
partitions up exactly as before.  It will probably keep running happily
until I try to reboot it.


___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread tom
I think fdisk -l should give you the old partition table as well, as 
long as you haven't rebooted or executed partprobe!

Bond Masuda wrote:
> if you haven't rebooted, look in:
>
> /proc/partitions
>
> to figure out your old partition table. use that data to re-create the
> partition table...
>
> if you've lost the info, you can try gpart to see if it can scan and figure
> it out:
>
> http://www.brzitwa.de/mb/gpart/index.html
>
> good luck!
> -Bond
>
>   
>> -Original Message-
>> From: linux-poweredge-boun...@dell.com [mailto:linux-poweredge-
>> boun...@dell.com] On Behalf Of J. Epperson
>> Sent: Tuesday, June 29, 2010 12:32 PM
>> To: linux-powere...@lists.us.dell.com
>> Subject: Blew away my partition table
>>
>> Arrived home very tired and in a lapse of judgement tried to configure
>> a
>> new USB backup drive on my PERC3 based home server, with a new cat
>> roaming
>> between me and the monitor.  Created a new partition on the existing
>> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
>> doing an rsync to the new drive now.
>>
>> Can some kind soul help me remember how to repair this surgically
>> instead
>> of rebuilding the filesystem and reloading it?  If not, I deserve it.
>>
>> ___
>> Linux-PowerEdge mailing list
>> Linux-PowerEdge@dell.com
>> https://lists.us.dell.com/mailman/listinfo/linux-poweredge
>> Please read the FAQ at http://lists.us.dell.com/faq
>> 
>
> ___
> Linux-PowerEdge mailing list
> Linux-PowerEdge@dell.com
> https://lists.us.dell.com/mailman/listinfo/linux-poweredge
> Please read the FAQ at http://lists.us.dell.com/faq
>   

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Chris Henderson
  If it is a fedora/centos/redhat based system, you might be able to get 
some partitioning hints out of /root/anaconda-ks.cfg.

--Chris

On 6/29/2010 2:39 PM, Ray Van Dolson wrote:
> On Tue, Jun 29, 2010 at 12:32:02PM -0700, J. Epperson wrote:
>> Arrived home very tired and in a lapse of judgement tried to configure a
>> new USB backup drive on my PERC3 based home server, with a new cat roaming
>> between me and the monitor.  Created a new partition on the existing
>> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
>> doing an rsync to the new drive now.
>>
>> Can some kind soul help me remember how to repair this surgically instead
>> of rebuilding the filesystem and reloading it?  If not, I deserve it.
> If you know exactly how the previous partitions were laid out, you can
> just recreate that structure.
>
> The underlying filesystem data will be fine.
>
> I'm sure there's a way to glean the partition structure information
> from the layout of data on your disk as well... especially if it was
> fairly simple (ie, /boot as ext2 and / as ext3 or LVM).
>
> Ray
>
> ___
> Linux-PowerEdge mailing list
> Linux-PowerEdge@dell.com
> https://lists.us.dell.com/mailman/listinfo/linux-poweredge
> Please read the FAQ at http://lists.us.dell.com/faq

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


RE: Blew away my partition table

2010-06-29 Thread Bond Masuda
if you haven't rebooted, look in:

/proc/partitions

to figure out your old partition table. use that data to re-create the
partition table...

if you've lost the info, you can try gpart to see if it can scan and figure
it out:

http://www.brzitwa.de/mb/gpart/index.html

good luck!
-Bond

> -Original Message-
> From: linux-poweredge-boun...@dell.com [mailto:linux-poweredge-
> boun...@dell.com] On Behalf Of J. Epperson
> Sent: Tuesday, June 29, 2010 12:32 PM
> To: linux-powere...@lists.us.dell.com
> Subject: Blew away my partition table
> 
> Arrived home very tired and in a lapse of judgement tried to configure
> a
> new USB backup drive on my PERC3 based home server, with a new cat
> roaming
> between me and the monitor.  Created a new partition on the existing
> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
> doing an rsync to the new drive now.
> 
> Can some kind soul help me remember how to repair this surgically
> instead
> of rebuilding the filesystem and reloading it?  If not, I deserve it.
> 
> ___
> Linux-PowerEdge mailing list
> Linux-PowerEdge@dell.com
> https://lists.us.dell.com/mailman/listinfo/linux-poweredge
> Please read the FAQ at http://lists.us.dell.com/faq

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Eberhard Moenkeberg
Hi,

On Tue, 29 Jun 2010, J. Epperson wrote:

> Arrived home very tired and in a lapse of judgement tried to configure a
> new USB backup drive on my PERC3 based home server, with a new cat roaming
> between me and the monitor.  Created a new partition on the existing
> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
> doing an rsync to the new drive now.
>
> Can some kind soul help me remember how to repair this surgically instead
> of rebuilding the filesystem and reloading it?  If not, I deserve it.

You just need to revert the partition table change.
If you do not have a backup of the master boot record (LILO would have 
one), you can use the df output to estimate the right cylinder numbers.

If you need trial and error to find the boundaries, "tune2fs -l /dev/sdaX" 
is a non-destructive test.



Viele Gruesse
Eberhard Moenkeberg (emoe...@gwdg.de, e...@kki.org)

-- 
Eberhard Moenkeberg
Arbeitsgruppe IT-Infrastruktur
E-Mail: emoe...@gwdg.de  Tel.: +49 (0)551 201-1551
-
Gesellschaft fuer wissenschaftliche Datenverarbeitung mbH Goettingen (GWDG)
Am Fassberg 11, 37077 Goettingen
URL:http://www.gwdg.de E-Mail: g...@gwdg.de
Tel.:   +49 (0)551 201-1510Fax:+49 (0)551 201-2150
Geschaeftsfuehrer:   Prof. Dr. Bernhard Neumair
Aufsichtsratsvorsitzender: Dipl.-Kfm. Markus Hoppe
Sitz der Gesellschaft: Goettingen
Registergericht:   Goettingen  Handelsregister-Nr. B 598
-

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread Ray Van Dolson
On Tue, Jun 29, 2010 at 12:32:02PM -0700, J. Epperson wrote:
> Arrived home very tired and in a lapse of judgement tried to configure a
> new USB backup drive on my PERC3 based home server, with a new cat roaming
> between me and the monitor.  Created a new partition on the existing
> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
> doing an rsync to the new drive now.
> 
> Can some kind soul help me remember how to repair this surgically instead
> of rebuilding the filesystem and reloading it?  If not, I deserve it.

If you know exactly how the previous partitions were laid out, you can
just recreate that structure.

The underlying filesystem data will be fine.

I'm sure there's a way to glean the partition structure information
from the layout of data on your disk as well... especially if it was
fairly simple (ie, /boot as ext2 and / as ext3 or LVM).

Ray

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Re: Blew away my partition table

2010-06-29 Thread J. Epperson
On Tue, June 29, 2010 15:32, J. Epperson wrote:
> Arrived home very tired and in a lapse of judgement tried to configure a
> new USB backup drive on my PERC3 based home server, with a new cat roaming
> between me and the monitor.  Created a new partition on the existing
> /dev/sda instead of the new /dev/sdb.  System is still running, and I"m
> doing an rsync to the new drive now.
>
> Can some kind soul help me remember how to repair this surgically instead
> of rebuilding the filesystem and reloading it?  If not, I deserve it.
>

EDIT: I created a new partition table, with no partitions as yet.  Shows
as "unallocated" in gparted.


___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq


Blew away my partition table

2010-06-29 Thread J. Epperson
Arrived home very tired and in a lapse of judgement tried to configure a
new USB backup drive on my PERC3 based home server, with a new cat roaming
between me and the monitor.  Created a new partition on the existing
/dev/sda instead of the new /dev/sdb.  System is still running, and I"m
doing an rsync to the new drive now.

Can some kind soul help me remember how to repair this surgically instead
of rebuilding the filesystem and reloading it?  If not, I deserve it.

___
Linux-PowerEdge mailing list
Linux-PowerEdge@dell.com
https://lists.us.dell.com/mailman/listinfo/linux-poweredge
Please read the FAQ at http://lists.us.dell.com/faq