[opensuse] dmraid partitions Lost & Found - howto

Listmates, I had not had the opportunity to deal with a complete loss of all partition information before and had to do a quick bit of learning on how to recover them (the long way because I was too dumb to move my "fdisk -l" saved information to a remote disk before beginning to beta test dmraid releases). Anyway, this information applies to all partition recovery and I stumbled across several tools I hadn't known of before so I thought I would pass the fun along. Also included is the information to recover your grub installation that is always a fairly hot topic, so this just might help some other lucky soul down the road. dmraid Partition Loss with dmraid-1.0.0rc15 Testing dmraid-1.0.0rc15 on a box with two separate dmraid arrays, I experienced the total loss of all partitions on the second dmraid array. The first array held an openSuSE install running dmraid-1.0.0rc14 while the second held Archlinux with dmraid-1.0.0rc15 where testing was being done. All testing of dmraid-1.0.0rc15 on Archlinux went fine, the problem occurred when the machine was boot back into openSuSE. There was a kenel update involved at the time that just might have created the perfect storm of differing dmraid metadata formats across OS's and a kernel update that the partitioning just couldn't handle. Regardless of the situation, whether using a raid setup or not, partition loss is serious business and hopefully this will help get you going again. dmraid Partition Recovery Recovery of dmraid partitions proceed in the same manner as recovering partitions from a singe drive. if you haven't destroyed the information on the array, you should be able to put the pieces of the puzzle back together again. The basic outline for the process is to locate and restore the partitions on the array and then reinstall the boot loader so your box is functional again. (Note: if you were smart enough to save the "fdisk -l" information for your drives, you can simply fdisk your array and be done) Tools Required A. Partition location and recovery software (I used testdisk) http://www.cgsecurity.org/ (main site) http://www.cgsecurity.org/wiki/TestDisk_Download (download page) http://www.cgsecurity.org/testdisk-6.11.linux26.tar.bz2 (prebuilt for 2.6 kernels) B. Rescue CD for your OS (generally your install CD/DVD, or knoppix, etc.) Using testdisk testdisk is a great piece of GPL code written by Christophe Grenier. testdisk can be used with most operating systems and will scan you disk or array and locate partition boundaries and give you the opportunity to recover them. I had 4 partitions dedicated to my Archlinux install totaling roughly 70G on a 750G raid array. To start testdisk, for Linux26, you will untar the bzip archive and then cd into the linux subdirectory. The prebuilt binary is: ./testdisk_static The first thing you will need to do is set the correct disk geometry. In my case the disk reported 254 heads and needed to be changed to 255 heads to work properly. (This is recommended if the first Quick Scan doesn't find your partitions and should be true of most 500G-1T drives on the market). After setting the geometry, just choose "Analyze" and "Quick Scan" and go get a coffee or something. In my case since the 70G I was using was at the front of the 750G array, it had found my partitions within 5 minutes or so. Once all of your partitions are found you can "Stop" the scan by hitting the return key. You are then presented with the list of found partitions. You may only want to recover some of the partitions found. They will be initially labeled "D" for deleted and you simply toggle on the partitions you need to recover by selecting ("P" Primary, "*" Primary Boot, "L" Logical or leave as "D" for Deleted). You are provided with the CHS information on the screen so you can map out what parts do and do not belong. testdisk will check your selections for partition overlap and give you confirmation in green if your partition layout is OK. Just hit return to continue. Don't worry about the extended partition boundary, it will be provided. Review the partitions to be recovered and choose "Write" and your are done. (a reboot is required to activate the partitions) If no partitions were found during the "Quick Scan", then (1) check your drive geometry setting; and (2) you will be given the option to do an "In Depth Scan" (go get 4 cups of coffee, walk the dog, etc...) Have Your Rescue CD Handy Once the partition information has been recovered and the partition table changed, there is a near 100% chance your boot loader configuration will be messed up. Don't worry, everything is still there, you just have to reinstall grub or lilo into the boot record to recover from the situation. The following grub recipe will apply regardless of whether you are working with dmraid or mdraid or just a plain single drive. Just use md-X for mdraid and use the normal sda, sdb, etc. for individual disks. dmraid was the example here because that just happened to be my lock set of disks for the day. Reinstalling Grub Here you will be booting from your CD or DVD into rescue mode, using dmraid to activate the arrays, and then using the information about the dm nodes in /dev/mapper and /dev/dm-X and the partition information in from "cat /proc/partitions" to create a chroot of your install to repair the boot loader: (1) boot from the install DVD (2) choose "Rescue System", login as "root" (no password needed) (3) activate the dmraid arrays with "dmraid -ay" (4) check which device nodes to use to create the chroot with "ls -al /dev/dm*" or "ls -al /dev/mapper". I was dealing with 2 separate arrays, 9 partitions (duplicated by having both dmraid-1.0.0rc14 and dmraid-1.0.0rc15 metadata) that left me with dm-0 to dm-20 to deal with. Compare the size shown for dm-X, /dev/mapper/raiddevice_name and the size shown from "cat /proc/partitions" to determine your "/", "/home", and "/boot" and any other partitions you need to setup in your chroot environment. (5) mount all dm-X devices or /dev/mapper devices under /mnt to create your actual filesystem, and then bind /dev/, /proc/ and /sys/ to their respective mount points under /mnt and chroot. **Note, you need to mount the device containing the / (root) filesystem first before mounting /boot and /home. Otherwise, the /boot and /home mount points will not exist: Example: mount /dev/dm-5 /mnt mount /dev/dm-7 /mnt/boot mount /dev/dm-6 /mnt/home mount -o bind /dev /mnt/dev mount -o bind /proc /mnt/proc mount -o bind /sys /mnt/sys cd /mnt chroot /mnt (6) Reinstall grub to fix the mbr on your raid discs (mine were hd0 and hd1). See http://wiki.archlinux.org/index.php/Installing_with_Fake-RAID#Install_GRUB for my notes on getting the (hdX,Y) numbers right. When you start grub, you get a small ">" prompt, just use the following as a guide. If you only have a single array, you will only need to worry about setting up hd0: grub >root (hd0,4) >setup (hd0) >*** few lines of grub output *** >root (hd1,5) >setup (hd1) >*** more lines of grub output *** >quit (7) check your /etc/grub.conf to make sure it agrees with the way you have just configured grub. For the example above, it should look like this for hd0 (I boot to hd0 and then chainload to get to hd1 and the second array) setup --stage2=/boot/grub/stage2 (hd0) (hd0,4) quit (8) exit (to exit chroot) and reboot, and if you were successful (or just damn lucky), your system will be 100% again. Now immediately do "fdisk -l > part.info.dev.name" on each of your arrays and drives and save that information remotely so if this happens again, you have a shortcut;-) This stuff was always painful, so I just took a moment to write it down so I would have it for the next go-round;-) -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

[On purpose sent to the list not as private mail. On Thu, 25 Jun 2009 23:44:11 -0500, you wrote:
I had not had the opportunity to deal with a complete loss of all partition
David, could you *please* configure your mail reader to use a line length maximum of 75 characters, i.e. send your mail to this list with a fixed line length? This would make reading and editing replies iin text mode MUAs like mutt a *lot* easier. Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

Philipp Thomas wrote:
[On purpose sent to the list not as private mail.
On Thu, 25 Jun 2009 23:44:11 -0500, you wrote:
I had not had the opportunity to deal with a complete loss of all partition
David, could you *please* configure your mail reader to use a line length maximum of 75 characters, i.e. send your mail to this list with a fixed line length? This would make reading and editing replies iin text mode MUAs like mutt a *lot* easier.
Doesn't mutt know how to fold lines properly? /Per -- Per Jessen, Zürich (19.6°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

In <h237lm$gff$2@saturn.local.net>, Per Jessen wrote:
Philipp Thomas wrote:
David, could you *please* configure your mail reader to use a line length maximum of 75 characters, i.e. send your mail to this list with a fixed line length? This would make reading and editing replies iin text mode MUAs like mutt a *lot* easier.
Doesn't mutt know how to fold lines properly?
Email is supposed to be wrapped at the sending side for maximum compatibility anyway. ISTR some issues with very old systems (probably not around anymore) that couldn't have more than 127 characters on one physical line. So, if non-wrapped mail was sent through them everything after the 127th character on each line was simply dropped. That is one of the reasons email headers (among other things) can be broken into multiple physical lines using the backslash+newline combination. -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/

On Fri, 26 Jun 2009 21:31:02 +0200, you wrote:
Doesn't mutt know how to fold lines properly?
Yes, but as it doesn't have a variable windowsize it looks awfull and is hard to read when mutt fills the screen as you can't tell it to format at a given line length. Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

On Sat, 27 Jun 2009, 02:08:59 +0200, Philipp Thomas wrote:
On Fri, 26 Jun 2009 21:31:02 +0200, you wrote:
Doesn't mutt know how to fold lines properly?
Yes, but as it doesn't have a variable windowsize it looks awfull and is hard to read when mutt fills the screen as you can't tell it to format at a given line length.
That's why I added a patch to mutt for additional customization years ago: set wrapcolumn=80 # Wrap text at column 80 If set to 0, no wrapping will occur. It was even documented in /usr/share/doc/packages/mutt/manual.txt.gz, but I couldn't find it in the current one anymore; the code still exists and works OK!
Philipp
Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

On Sat, 27 Jun 2009 11:00:48 +0200, you wrote:
set wrapcolumn=80 # Wrap text at column 80
Oh, I didn't know that option existed! I'll adapt my muttrc right away.
but I couldn't find it in the current one anymore;
I guess that's why I didn't know about it. Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

On Sat, 27 Jun 2009, 13:39:04 +0200, Philipp Thomas wrote:
On Sat, 27 Jun 2009 11:00:48 +0200, you wrote:
set wrapcolumn=80 # Wrap text at column 80
Oh, I didn't know that option existed! I'll adapt my muttrc right away.
but I couldn't find it in the current one anymore;
I guess that's why I didn't know about it.
FWIW, here's what it looks/ed like: 6.3.277. wrapcolumn Type: number Default: 0 Controls at which column mutt's pager does smart wrapping. If set to 0, no smart wrapping is done. If set to a value larger than what the current display can handle, this value is ignored. HTH, cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

On Sat, Jun 27, 2009 at 04:10:39PM +0200, Manfred Hollstein wrote:
On Sat, 27 Jun 2009, 13:39:04 +0200, Philipp Thomas wrote:
On Sat, 27 Jun 2009 11:00:48 +0200, you wrote:
set wrapcolumn=80 # Wrap text at column 80
Oh, I didn't know that option existed! I'll adapt my muttrc right away.
but I couldn't find it in the current one anymore;
I guess that's why I didn't know about it.
FWIW, here's what it looks/ed like:
6.3.277. wrapcolumn
Type: number Default: 0
Controls at which column mutt's pager does smart wrapping. If set to 0, no smart wrapping is done. If set to a value larger than what the current display can handle, this value is ignored.
I've just found this one: wrap Type: number Default: 0 When set to a positive value, mutt will wrap text at $wrap characters. When set to a negative value, mutt will wrap text so that there are $wrap characters of empty space on the right side of the terminal. It's documented in muttrc(5) -- Best regards / s pozdravem Petr Uzel, Packages maintainer --------------------------------------------------------------------- SUSE LINUX, s.r.o. e-mail: puzel@suse.cz Lihovarská 1060/12 http://www.suse.cz 190 00 Prague 9 Czech Republic -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

On Mon, 29 Jun 2009, 08:39:34 +0200, Petr Uzel wrote:
On Sat, Jun 27, 2009 at 04:10:39PM +0200, Manfred Hollstein wrote:
On Sat, 27 Jun 2009, 13:39:04 +0200, Philipp Thomas wrote:
On Sat, 27 Jun 2009 11:00:48 +0200, you wrote:
set wrapcolumn=80 # Wrap text at column 80
Oh, I didn't know that option existed! I'll adapt my muttrc right away.
but I couldn't find it in the current one anymore;
I guess that's why I didn't know about it.
FWIW, here's what it looks/ed like:
6.3.277. wrapcolumn
Type: number Default: 0
Controls at which column mutt's pager does smart wrapping. If set to 0, no smart wrapping is done. If set to a value larger than what the current display can handle, this value is ignored.
I've just found this one:
wrap Type: number Default: 0
When set to a positive value, mutt will wrap text at $wrap characters. When set to a negative value, mutt will wrap text so that there are $wrap characters of empty space on the right side of the terminal.
Yeah, but this one doesn't allow you to break at an absolut column number; when you resize your xterm, i.e. make it larger, mutt will still wrap at (absolute_width - wrap). I'd prefer it to wrap at an absolute position, that's why I wrote that patch (and sent it upstream).
It's documented in muttrc(5)
My stuff was also documented everywhere, at least up until SLES 10 SP2. Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

In <20090629065851.GA8264@saturn.hollstein.homelinux.org>, Manfred Hollstein wrote:
On Mon, 29 Jun 2009, 08:39:34 +0200, Petr Uzel wrote:
On Sat, Jun 27, 2009 at 04:10:39PM +0200, Manfred Hollstein wrote:
On Sat, 27 Jun 2009, 13:39:04 +0200, Philipp Thomas wrote:
On Sat, 27 Jun 2009 11:00:48 +0200, you wrote:
set wrapcolumn=80 # Wrap text at column 80
Oh, I didn't know that option existed! I'll adapt my muttrc right away.
FWIW, here's what it looks/ed like:
6.3.277. wrapcolumn
Type: number Default: 0
Controls at which column mutt's pager does smart wrapping. If set to 0, no smart wrapping is done. If set to a value larger than what the current display can handle, this value is ignored.
I've just found this one:
wrap Type: number Default: 0
When set to a positive value, mutt will wrap text at $wrap characters. When set to a negative value, mutt will wrap text so that there are $wrap characters of empty space on the right side of the terminal.
Yeah, but this one doesn't allow you to break at an absolut column number; when you resize your xterm, i.e. make it larger, mutt will still wrap at (absolute_width - wrap). I'd prefer it to wrap at an absolute position, that's why I wrote that patch (and sent it upstream).
Read the quoted documentation again. If wrap is a positive value it is an absolute column. If wrap is a negative value it is a floating margin. It seems your patch is now unnecessary. Perhaps because upstream changed the way wrap works? -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/

On Mon, 29 Jun 2009, 17:59:57 +0200, Boyd Stephen Smith Jr. wrote:
In <20090629065851.GA8264@saturn.hollstein.homelinux.org>, Manfred Hollstein wrote:
On Mon, 29 Jun 2009, 08:39:34 +0200, Petr Uzel wrote:
On Sat, Jun 27, 2009 at 04:10:39PM +0200, Manfred Hollstein wrote:
On Sat, 27 Jun 2009, 13:39:04 +0200, Philipp Thomas wrote:
On Sat, 27 Jun 2009 11:00:48 +0200, you wrote:
set wrapcolumn=80 # Wrap text at column 80
Oh, I didn't know that option existed! I'll adapt my muttrc right away.
FWIW, here's what it looks/ed like:
6.3.277. wrapcolumn
Type: number Default: 0
Controls at which column mutt's pager does smart wrapping. If set to 0, no smart wrapping is done. If set to a value larger than what the current display can handle, this value is ignored.
I've just found this one:
wrap Type: number Default: 0
When set to a positive value, mutt will wrap text at $wrap characters. When set to a negative value, mutt will wrap text so that there are $wrap characters of empty space on the right side of the terminal.
Yeah, but this one doesn't allow you to break at an absolut column number; when you resize your xterm, i.e. make it larger, mutt will still wrap at (absolute_width - wrap). I'd prefer it to wrap at an absolute position, that's why I wrote that patch (and sent it upstream).
Read the quoted documentation again. If wrap is a positive value it is an absolute column. If wrap is a negative value it is a floating margin. It seems your patch is now unnecessary. Perhaps because upstream changed the way wrap works?
Indeed. I just checked the value of $wrap and $wrapcolumn in mutt, and it appears that wrapcolumn is now a tracked alias for wrap. Great, thx! Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

Manfred Hollstein wrote:
That's why I added a patch to mutt for additional customization years ago:
set wrapcolumn=80 # Wrap text at column 80
If set to 0, no wrapping will occur. It was even documented in /usr/share/doc/packages/mutt/manual.txt.gz, but I couldn't find it in the current one anymore; the code still exists and works OK!
Whoa! Cool, indeed. Thanks for pointing this out (and even more for writing the patch on first hand ;^>) Pit -- Dr. Peter "Pit" Suetterlin http://www.astro.su.se/~pit Institute for Solar Physics Tel.: +34 922 405 590 (Spain) P.Suetterlin@royac.iac.es +46 8 5537 8534 (Sweden) Peter.Suetterlin@astro.su.se -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

On Friday 26 June 2009 08:43:02 am Philipp Thomas wrote:
[On purpose sent to the list not as private mail.
On Thu, 25 Jun 2009 23:44:11 -0500, you wrote:
I had not had the opportunity to deal with a complete loss of all partition
David, could you *please* configure your mail reader to use a line length maximum of 75 characters, i.e. send your mail to this list with a fixed line length? This would make reading and editing replies iin text mode MUAs like mutt a *lot* easier.
Philipp
Sure, Sorry Philipp, I just started using kmail with kde 4.3 beta 2 and I HATE the way it wraps mail, breaks web addresses in half, and there is no "Edit as New" option like you have with thunderbird to be able to pull from your sent mail without having to copy and paste into kwite the "join" all the lines again before you can use it. I thought all mail readers would just wrap the lines. I have re-check the compose option to wrap at the default 78. Should work now ;-) -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

David, Since you've become the dmraid expert, one question that I should know but I don't is: Is dmraid a seperate project from dm (device mapper)? ie. Most kernel projects have their own mailing list, project team, maintainer, etc.. I had always *assumed* dmraid was a standalone kernel project, but I've recently seen some posts that imply it is part of dm. Thanks Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer Preservation and Forensic processing of Exchange Repositories White Paper - http://www.norcrossgroup.com/forms/whitepapers/Forensic%20Processing%20of%20... The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org

On Friday 26 June 2009 12:22:50 pm Greg Freemyer wrote:
David,
Since you've become the dmraid expert, one question that I should know but I don't is:
Is dmraid a seperate project from dm (device mapper)?
ie. Most kernel projects have their own mailing list, project team, maintainer, etc.. I had always *assumed* dmraid was a standalone kernel project, but I've recently seen some posts that imply it is part of dm.
Thanks Greg
Yes and No :p They are both redhat projects but with different authors. "device-mapper" gives you "dmsetup" and was originally done by Joe Thornber (thornber@sistina.com). See: http://sources.redhat.com/dm/ dmsetup creates the raid environment, creates the entries (dmraid nodes) in /dev/mapper, etc. dmraid - activates, deactivates and accounts for the running raid processes and it is manned by Heinz Mauelshagen <Mauelshagen@RedHat.com>. I have a link to his page at redhat somewhere, but can't put my finger on it at the moment. Just google his name and redhat and it will pop up. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (8)
-
Boyd Stephen Smith Jr.
-
David C. Rankin
-
Greg Freemyer
-
Manfred Hollstein
-
Per Jessen
-
Petr Uzel
-
Philipp Thomas
-
Pit Suetterlin