LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Fdisk..removed wrong partition...help please (https://www.linuxquestions.org/questions/slackware-14/fdisk-removed-wrong-partition-help-please-455951/)

air4time 06-18-2006 10:53 AM

Fdisk..removed wrong partition...help please
 
This will be a long post sorry in advance.

I posted in newbie "http://www.linuxquestions.org/questions/showthread.php?p=2296327#post2296327"
and was told to try here for the rest of the problem.

Here is the last part"
" Mmmm - you create partitions from something like fdisk. I don't understand your use of {NO partition can be set to the "primary 2"}.
Just create partition(s), and let them create where they may. After a reboot, then you can attempt a mkfs on it."

Fdisk had no problem with putting it to primary 2 after reboot fdisk still showed everything as ok. But when I went to mkfs it complained about it not being a device block(or something like that) After I was able to put any where but primary 2 I looked into the /dev and seen "/dev/hdb2" was a directory but none of the other ones was. So I deleted the directory and rebooted. Then it said no such device(or something like that). I then deleted the partition with fdisk, rebooted then added again still no luck. My best guess is I did something to "/dev/hdb2" sometime and just now caught it. I need to know how to restore it.
"
If more info is needed please ask I did not want to repost everything since most is fixed.

Thanks Lonnie

Randux 06-18-2006 11:11 AM

I can't understand from your writing what you did, what you wanted to happen, and what happened instead.

But, you do not have to make a filesystem to install Slackware.

Boot from the Slackware installation disc (disc 1 of 4) and go through the installer.

It will lead you through the partitioning (fdisking) step. Then it will ask you where you want to mount various filesystem points like root (/). You will have the option to build the filesystem you want under the installation dialog - let Slackware do this. You don't have to do this step outside the installation scripts or use any special commands unless you have a good reason.

air4time 06-18-2006 11:30 AM

Thanks Randux
"I can't understand from your writing what you did, what you wanted to happen, and what happened instead."
Sorry, I mistaking deleted a partition on my second drive and maded a new one and then rebooted. I was able to get the lost partition back using "testdisk" but could not put anything in the primary "2" spot. After many reboots and fdisks I discoverd that the "/dev/hdb2" was now in fact a dir not a "link"(guess that is what it is called" like the rest of them are. So I tried to deleted it and then reboots, more fdisks and shutdowns but still could not put anything in the "primary "2" spot or should I say I could in fact make the partition use primary "2" with fdisk but when I tried to format it using mkfs it complained and would not do it. That is when I found the "/dev/hdb2" problem. I even tried to rename "/dev/hdb20" to "/dev/hd2" but still mkfs complained. I have rebooted,shutdown, had 20 gig free, nothing seems to fix the corrupted "/dev/hdb2" problem. Fdisk never complained but mkfs did. I am assumming I missed up the /dev/hdb2 somehow so I need to fix it. Thanks hope this clears things up a little

Lonnie
Forgot to add I am using Linux ver 2.6.16.1

Randux 06-18-2006 12:14 PM

Hi Lonnie,

I'm sorry but because of the English I'm still not understanding you 100%.

Remember that the partition table is just like an index to your data on the disk- it is not the data itself.

So if you delete a partition or change the type, or do almost anything to the partition table, you can always change it back ...... if...... you didn't change the data on the disk and.....if you wrote down what you had in the partition table before or saved the output from fdisk.

If you have the information, you can restore the partition table by hand using fdisk. If you don't, you can try some recovery live CD, but I never used one.

It's important before you start fdisking to make backups of anything you can't afford to lose and do something like

Code:

fdisk -l > myfdisk.txt
before you start. Then if you make any mistakes you can use the printout to help you fix it. Go slow and pay attention and it will be ok.

If you lost some data, search this forum for more info on recovering lost partitions. There are some threads.

air4time 06-18-2006 01:08 PM

Thanks for the help Randux

Look at this "http://www.linuxquestions.org/questions/showthread.php?p=2296327#post2296327"

It may help explain better. Thx for the "fdisk -l > myfdisk.txt" I will do that. I already recovered the partition and all data. I just can not figure out why I can not format a partition if it is using the primary 2 spot. Only thing I can figure is the "/dev/hdb2" is bad.

Look maybe this can help

root@dadslinux:/home/dad# ls -l /dev/hdb3
brw-rw---- 1 root disk 3, 67 2006-06-17 20:57 /dev/hdb3
root@dadslinux:/home/dad# ls -l /dev/hdb2
brw-rw---- 1 root disk 3, 84 2002-06-09 19:27 /dev/hdb2
root@dadslinux:/home/dad# ls -l /dev/hdb4
brw-rw---- 1 root disk 3, 68 2006-06-17 23:35 /dev/hdb4
root@dadslinux:/home/dad# ls -l /dev/hdb1
brw-rw---- 1 root disk 3, 65 2006-06-17 20:57 /dev/hdb1
maybe have something to do with 84?

Thanks Lonnie

Randux 06-18-2006 01:29 PM

Lonnie if we need to look at the partition table please print the output from fdisk -l (run it as root). And use the # (code tags) around it so that it will line up so we can read it. And we'll try to understand. Thanks,Rand.

air4time 06-18-2006 01:55 PM

ok here it is

Code:

root@dadslinux:/home/dad# fdisk -l

Disk /dev/hda: 40.0 GB, 40020664832 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1        1216    9767488+  c  W95 FAT32 (LBA)
/dev/hda2            1217        3587    19041074    5  Extended
/dev/hda3            3587        4400    6534406  83  Linux
/dev/hda5            1217        1600    3084448+  83  Linux
/dev/hda6            1601        1800    1606468+  83  Linux
/dev/hda7            1801        2294    3968023+  83  Linux
/dev/hda8            2295        2322      216184+  82  Linux swap
/dev/hda9            2322        2887    4535968+  83  Linux
/dev/hda10          2887        3161    2206594  83  Linux
/dev/hda11          3162        3586    3413781    b  W95 FAT32

Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdb1  *          1        1912    15358108+  a5  FreeBSD
/dev/hdb3            3500        4865    10972395  83  Linux
/dev/hdb4            1913        3499    12747577+  83  Linux

Partition table entries are not in disk order


Randux 06-18-2006 02:02 PM

Ok, now I can see what is happening.

You have your whole disk already defined. hdb1 goes from 1 to 1912, hdb4 goes from 1913 to 3499, and hdb3 goes from 3500 to 4865.

You don't have any more room on this disk. If this partition table is wrong, you can fix it by using fdisk. Delete the incorrect entry(s) and build new ones, write the partition table, and reboot.

If you don't know what the original values are, you will have to figure them out with some diagnostic tool, and I don't know how to help you. But people here have used that stuff.

air4time 06-18-2006 04:56 PM

Thanks for trying for some reason we are not on the same page. I can not put any partition on /dev/hdb2 no matter what. I tried at 10 times , at least 10 different ways,reboots and shutdowns after each, 20 gig free, with no other partitions, with other partitions, with just 2 partitions, it does not matter it will not allow me to format(mkfs) anything on /dev/hdb2 the other 3 prime( /dev/hdb1,/dev/hdb3 or /dev/hdb4 )is fine just not /dev/hdb2. Fdisk will put the partition on /dev/hdb2 but I can not access it then. Even when testdisk fixed the missing partition and put it on /dev/hd2 I could not access it.

/dev/hdb2 is corrupted some how. I need to find out how to fix that. Everything else is fine. I am just wanting to know for in case in the future I need to know. I had to put the second partition on /dev/hdb3 and I know there must be a better way.

Lonnie

gbonvehi 06-18-2006 06:09 PM

Make: ls -l /dev/hdb2 it should point to device 3 66. If it doesn't (in the other post you said you renamed hdb20 to it, which won't work) goto /dev and type: mknod hdb2 b 3 66

Edit: You should delete /dev/hdb2 first :)

air4time 06-18-2006 06:28 PM

Thanks gbonvehi

"mknod hdb2 b 3 66"
I think that will do it.

Lonnie


All times are GMT -5. The time now is 11:34 PM.