On a deabian 8.2 system I made a new LVM partition with fdisk and wanted to issue a pvcreate command, but was constantly being called and then made this horrible horrible mistake. Before the call I checked if everything was ok:
Command (m for help): p Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x33eeab93 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2046 1953791 1951746 953M 5 Extended /dev/sda2 1953792 19531775 17577984 8.4G 8e Linux LVM /dev/sda3 19531776 41940991 22409216 10.7G 8e Linux LVM /dev/sda4 41940992 104857599 62916608 30G 8e Linux LVM /dev/sda5 2048 1953791 1951744 953M 8e Linux LVM Partition table entries are not in disk order.
After the call I thought I finished with fdisk:
Command (m for help): sudo pvcreate /dev/sda4 Created a new partition 1 of type 'Linux native' and of size 50 GiB. Created a new partition 2 of type 'Linux swap' and of size 47.1 MiB. Created a new partition 3 of type 'Whole disk' and of size 50 GiB. Created a new Sun disklabel.
But it was still running and to make things worse I saved the changes.
Made a database dump and stored it on another machine. And now I am searching for a good solution hoping to implement tomorrow.
A option is to roll out another server and set it up and import the DB dump there, but that does not feel efficient and the database will be unreachable for a short moment.
Started searching the web and found http://tldp.org/HOWTO/Partition/recovering.html which would be a last resort option without rolling out another server. With testdisk I can see all the partitions and data I need, but the program is not that clear to me.
So I would like to ask, is testdisk a good option in this situation?
If so, please read the following:
When I start the program a list of disks is presented, here I can choose /dev/sda, but it also lists /dev/mapper/vg... & /dev/dm-... As I feel I messed with the whole disk I chose /dev/sda it finds the new 'Whole disk' partition, so I wont choose write here.
But when I pick /dev/mapper/vg-srv-lv-srv it detects a none type partition and I do get my ext4 partition under advanced and can copy files or make an image, change type or locate Superblock, but when I choose Analyse I can't write as the table type None is selected.
Should it be as simple as changing the partition type back with fdisk or selecting ext4 in testdisk, and write back the old partitions after analysing? Any extra details to be mindful of in case of LVM?
The program looks hopeful, but I don't feel confident enough to just go try and see what happens. Please advice. Also other solutions are welcome.
Thanks in advance from a person that will never answer the phone again when running fdisk.