# Problem migrating 2.4 to 2.6: extended partitions missing

## martinblech

I'm in the process of updating from kernel version 2.4.26 to 2.6.11 and I'm stuck because my extended partitions (hda5, hda6 and so on) don't show up in the /dev directory. I followed the migration guide (http://www.gentoo.org/doc/en/migration-to-2.6.xml) step by step, going all over it several times. Any ideas? Thanks.

----------

## penguinlnx

I had partitions refuse to appear from previous installs that I really wanted, and they were on an extended partition.

First drop into the commandline and see if your partitions are even still there:  If not, you probably need special tools to recover them, and that is beyond the scope of this post. 

```
#FDISK /dev/hda <enter> (if necessary boot off a liveCD)

(from within FDISK type:) P (list partitions) and take a careful note of what you see. If they are gone, you need to find a specialist.
```

What I did was create special subfolders in /MNT first, from the commandline (if in GNOME open a console):

```
# mkdir /mnt/part1

#mkdir /mnt/part2 ...etc

#mount -t ext3 /dev/hda1 /mnt/part1 <enter> (etc...)
```

...mounting each partition in a subfolder.

When you want these to be mounted automatically, you must edit your /etc/fstab  file.  Be careful.

----------

## martinblech

The problem isn't that the partitions don't get mounted, it's that they don't show up in /dev. When I do 

```
#ls /dev/hda*
```

 I only get

```
/dev/hda

/dev/hda1

/dev/hda2

/dev/hda3

/dev/hda4
```

The partitions are there still. When I reboot in 2.4 they get mounted and everything is fine.

The last time I tried to boot in 2.6, I took a good look at the kernel messages and I found that the IDE/ATAPI driver detects all the partitions. It displays something like

```
hda1 hda2 hda3 hda4 <hda5 hda6 hda7>
```

. Anyway, they're not in /dev and when I login I get an error message because the system can't find my home directory (/home is hda5).

Any ideas?

----------

## penguinlnx

Here's another idea:  Since the symptoms only show between the two kernels, is it possible that one of the file format types didn't get compiled?  If the partitions you want to access are on a (WINDOWS) Extended partition, you still need to have those file formats in the kernel, even if none of your partitions are actually NTFS or whatever.  If you had originally a Windows or DOS drive, but repartitioned it with a Linux FDISK or GUI partitioner, it may well still have artifacts or aspects that classify it as a Microsloff drive.  

If you kept the kernel config files for each kernel, you could run through the file system sections to see if there are any differences.

Alternately, recompile the kernel carefully checking all the file stuff and including whatever might be needed, even if it bloats the kernel a little.

I would still like to see your  /etc/fstab file though if you could post it...

----------

## martinblech

Here's my fstab:

```
/dev/hda2               /               reiserfs        noauto,noatime         0 0

/dev/hda1               /boot           ext2            auto,noatime           0 0

/dev/hda6               /home           reiserfs        auto,noatime           0 0

/dev/hda5               none            swap            sw                     0 0

/dev/cdroms/cdrom0      /mnt/cdrom      auto            noauto,ro,user         0 0

/dev/fd0                /mnt/floppy     auto            noauto,user,umask=0,utf0 0

/dev/hda7               /mnt/cosas      vfat            auto,user,rw,umask=0,sync,utf8  0 0

/dev/hda3               /mnt/windows    ntfs            auto,user,sync,umask=0022       0 0

/dev/sda2               /mnt/ipod       vfat            noauto,user,umask=0,sync 0 0
```

Note that hda2 and hda6 are both reiserfs partitions, but only hda2 (root) gets mounted. If the problem was the file system module none of the partitions would've been mounted and the system wouldn't even boot. The system boots just fine, X starts and I get the gdm login screen. The problem arises when I try to login because my home directory isn't there (hda6).

Here is my partition info for hda, just in case:

```
Disk /dev/hda: 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/hda1               1           5       40131   83  Linux

/dev/hda2               6        1002     8008402+  83  Linux

/dev/hda3   *        1003        1999     8008402+   7  HPFS/NTFS

/dev/hda4            2000        4865    23021145    5  Extended

/dev/hda5            2000        2036      297171   82  Linux swap / Solaris

/dev/hda6            2037        2535     4008186   83  Linux

/dev/hda7            2536        4865    18715693+   b  W95 FAT32
```

----------

## martinblech

I'm still lost here. Can anyone help me? I'm stuck with 2.4 for now... :Confused: 

----------

## penguinlnx

 *Quote:*   

> If the problem was the file system module none of the partitions would've been mounted and the system wouldn't even boot. 

 

Okay, I don't think you quite understood what I said in the previous post.  I will try to explain it again.

(1) There is obviously a difference between the two kernels.

(2) That difference is not in the Reiserfs module.  Both kernels have it, since hda2 mounts. 

(3) In the MSwindows and other versions of FDISK or disk partition programs, 

you are only allowed 4 primary partitions.

(4) Microsoft got around this by inventing EXTENDED partitions, and everybody else copied them for compatibility.

(5) An extended partition is just a shell that holds more partitions. 

(6) for  a disk to have 7 partitions, 3 can be primary, but one must be extended, and it will hold the other 4 partitions inside it.

(7) Your disk probably has an extended partition, which contains at least three partitions.

The partition which refuses to mount is probably inside an extended partition. 

( :Cool:  Linux is perfectly happy using partitions created by MSwindows, or co-residing on a drive partitioned by MSwindows.

(9) Linux will not normally completely redo the MBR or the Partition structure if all you need is to make a few new partitions to install it.

(10) This way, you can have an MSwindows OS which follows its own system of structuring partitions and a Linux OS on the same drive.

(11) It seems likely that regardless of how your drive was created, it has extended partitions.

(12) The new 2.6 kernel will need MSwindows FS modules installed in order to maintain backward compatibility with the Hard Drive.

(13) Some part of the drive has an unusual structure, or an extended partition which just loading reiserFs will not solve.

Thus  I would say the bad news is that you will have to re-compile your kernel to include more file-structure services:

I personally don't know exactly what those are, but someone else here with more Linux partitioning experience and kernel experience 

should be able to solve this simple problem.

----------

## martinblech

I ran through all kernel options again and I found some disabled "MS-windows partition support" options. I enabled them and left the kernel compiling at home. Later when I get back from work I'll check if it works now, but I'm pretty sure that we've hit the nail. Thanks a lot. :Very Happy: 

----------

## martinblech

It didn't work. I enabled Windows LDM support in File Systems/Partition Types and hoped it would work, but it didn't. Fat, vfat and ntfs were all enabled from the beginning, so that wouldn't fix it either.

I understand the primary and extended partition thing, I'm no expert but not such a newbie either: hda4 is an extended partition, hda5, hda6 and hda7 are all contained by it.

The situation is still the same, none of my extended partitions can be mounted because their /dev/hda[5,6,7] entries aren't there. Even with those partitions not showing up in /dev, if i run fdisk /dev/hda on that "broken" kernel I can still see them there. If I had a broken partition descriptor, fdisk would complain, right? Anyway, if that was the case, is there a way of fixing it? Besides that, how come the "hda1 hda2 hda3 hda4 <hda5 hda6 hda7>" line appears during boot, somehow indicating that the extended partitions between braces are detected, but then they're not there anymore? :Sad: 

----------

## penguinlnx

I don't think that's quite right:  

(1) FDISK, if it is anything like its DOS namesake, is meant to run as a standalone program independant of any kernel support.

It has to be able to read and write to drives, and create partitions even if nothing is there at all.  

(2) For instance, FDISK and various GUI versions of Partition programs are meant to run before any OS is installed at all, and are usually runable from the most primitive of launching shells. 

(3) These programs can clearly write partitions of any flavour and format them whether or not you have installed or loaded modules in your kernel. 

(4) Although you usually have a full-blown OS running off the CD or floppy when you install, I don't think it is needed by the FDISK program.

(5) Only the base (probably BIOS) hard drive support calls are likely used by the programs in reading and writing partitions and BOOT sectors.

(6) GRUB is also a kind of stand-alone program that specifically writes to the BOOT partition and probably the MBR (Master Boot Record)  as well, since it often trashes the MBR on a windows drive!  These functions seem to be independant of the kernel, although GRUB needs a partitioning program like FDISK to have created the BOOT partition itself.

From this I would reason that you could have faulty file modules in the kernel or faulty source code from which you are compiling your kernel or modules, and still have both FDISK and GRUB work properly (or appear to work.)

It would be great however, if someone who really knows the nuts and bolts of this could look over this thread and offer some useful suggestions.  If no one else replies, I am going to hunt people down in other forums to get help for you.

----------

## penguinlnx

Here is what my (working) FSTAB file looks like: Especially compare the key system partitions and also how I defined the other partitions I wanted to mount:

```

# ================================== /ETC/FSTAB ============ LAST EDIT: Apr 30 11:59 ===

# /etc/fstab: static file system information.

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13  azarah Exp $

# This file is edited by fstab-sync - see 'man fstab-sync' for details

# NOATIME - turns off atimes for increased performance (atimes normally aren't needed)

# NOTAIL  - increases performance of ReiserFS (at the expense of storage efficiency) 

#  It's safe to drop noatime if you want and to switch between notail and tail freely.

# ======================================================================================

# <fs> --------------<mountpoint> ------<type>---------<opts> --------------<dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/hdb1   /mnt/gentoo/boot   ext2      noatime         1 2

/dev/hdb2   none         swap      sw         0 0

#========================================================== BEGIN Extended Partition ===

#------------ Windows extended partition: not directly used -holds hda4 & hda5 ---------

#/dev/hdb3              /mnt/idedisk2   auto            noatime             0 1

#------------ Linux current install root partition  ------------------------------------

/dev/hdb4      /      reiserfs   noatime,notail      0 1

#------------ Linux partition from previous install with data files --------------------

/dev/hdb5               /mnt/idedisk1   ext3            noatime                   0 1

#------------------------------------------------------------ END Extended Partition ===

#=========================================================== BEGIN Win2K BOOT DRIVE ====

#...........Assume Linux Drive has been switched to hdb (HD1) so Win2K is hda (HD0).....

/dev/hda2      /mnt/secure1   auto      noatime         0 1

/dev/hda3      /mnt/secure2   auto      noatime         0 1

#-------------------------------------------------------------------- END Win2K --------

#=========================================================== BEGIN other Devices =======

/dev/cdroms/cdrom0   /mnt/cdrom   auto      noauto,user      0 0

#/dev/cdrom1            /mnt/cdrom      iso9660         noauto,ro,user          0 0

#/dev/cdrw              /mnt/cdrw       iso9660         noauto,noatime,user     0 0

#/dev/dvd               /mnt/dvd        iso9660         noauto,ro,user          0 0

#/dev/dvdrw             /mnt/dvdrw      iso9660         noauto,noatime,user     0 0

#/dev/dvdram            /mnt/dvdram     udf             noauto,noatime,user     0 0

#/dev/fd0               /mnt/floppy     msdos           noauto                  0 0 

#/dev/fd0      /mnt/floppy   auto      noauto         0 0

#============================================================= BEGIN Special bits ======

# ------------NOTE: The next line is critical for boot!---------------------------------

none         /proc      proc      defaults      0 0

#---------------------------------------------------------------------------------------

# (tmpfs is a dynamically expandable/shrinkable RAMDISK, and uses little mem when empty)

# glibc 2.2 + needs tmpfs mounted at /dev/shm for POSIX shared mem(shm_open, shm_unlink) 

none         /dev/shm   tmpfs      defaults      0 0

#=================================== END of /ETC/FSTAB =================================

/dev/hdc                /media/cdrecorder       auto    exec,user,noauto,managed 0 0

/dev/floppy/0           /media/floppy           auto    exec,user,noauto,managed 0 0
```

----------

## LinuxPingu

Hi martinblech,

Maybe your problem has to do with the switch form devfs (2.4) to udev (2.6)??

Take a look at: http://www.gentoo.org/doc/en/udev-guide.xml#doc_chap1

Just an idea, hope it helps.

Greetings

----------

## pilo

I was wondering which device-daemon is in use, since this is never mentioned. I am more inclined to believe that the error lies within device-population than kernel modules. Also, what partitions can you find in /proc/? Can't remember where they lie, but they are there.. unfortunately I am stuck in military service so I can't find the path for you.

Which program did you use to create the extended partition? This _should_ not affect the partition table, since Linux and Windows uses the same as long as we're not speaking LDM, but you never know.

----------

