# missing sda1

## jyoung

I'm trying to setup my USB port for a memory stick, but I'm having trouble. I followed the directions in the USB guide (http://www.gentoo.org/doc/en/usb-guide.xml), recompiled my kernal, and rebooted with no obvious problems. I wasn't able to mount my USB drive, and found that I don't seem to have a /dev/sda1 - is there anything else it might be called? What might be wrong?

----------

## alex.blackbit

lspci should tell you if your usb controller is a known device.

after you pluged a usb device in, run dmesg to see if something happens.

if yes you will see what device name was assigned, if no somethings is still wrong with your kernel.

----------

## jyoung

If I plug the USB device in, dmesg does report it as using address 3, but it doesn't seem to say what the device is called.  The exact text returned by dmesg is:

usb 1-1: new full spped USB device using address 3

----------

## alex.blackbit

maybe your kernel is missing the support for the filesystem on the stick.

----------

## jyoung

How would I determine if my kernal is missing support for the filesystem on the device?  And if so, repair it?  It's just a pen drive, so what kind of file system would it be using?  I know the pen drive works with other (linux) machines.

----------

## wynn

 *jyoung wrote:*   

> How would I determine if my kernal is missing support for the filesystem on the device?

 Try

```
zgrep 'MSDOS_FS\|VFAT_FS' /proc/config.gz
```

You should get

```
CONFIG_MSDOS_FS=y

CONFIG_VFAT_FS=y
```

 *jyoung wrote:*   

> And if so, repair it?

 Enable

```
-> File systems

    -> DOS/FAT/NT Filesystems

<*> MSDOS fs support

<*> VFAT (Windows-95) fs support
```

 *jyoung wrote:*   

> It's just a pen drive, so what kind of file system would it be using?  I know the pen drive works with other (linux) machines.

 They would have these kernel options enabled.

----------

## jyoung

I get:

CONFIG_MSDOS_FS=m

CONFIG_VFAT_FS=m

Even after I changed menuconfig and recompiled and rebooted.  Is there a step I'm missing?

----------

## wynn

Do you mean that you recompiled the kernel with these two builtin, installed the new kernel on top of the old one, rebooted and still had them show up in /proc/config.gz as modules?

Still, modules should be OK as long as it's not the root filesystem. If the kernel/udev doesn't load the modules automatically when the pen drive is plugged in, you could modprobe them

```
modprobe -vv msdos

modprobe -vv vfat
```

and it should be able to decipher the fs on the flash drive.

----------

## jyoung

I made the modifications in "make menuconfig" in /usr/src/linux, ran "make" in usr/src/linux, and then rebooted.

Running modprobe as you suggested seemed to load the modules, but I still could mount (or find) /dev/sda1.

----------

## wynn

 *jyoung wrote:*   

> I made the modifications in "make menuconfig" in /usr/src/linux, ran "make" in usr/src/linux, and then rebooted.
> 
> Running modprobe as you suggested seemed to load the modules, but I still could mount (or find) /dev/sda1.

 Ok, that doesn't seem to solve the problem.

To go back a bit, before plugging in the pen drive, could you check /dev/disk

```
ls -lR /dev/disk >/tmp/ls-lR.dev.disk
```

and, after plugging in the pen drive, run

```
ls -lR /dev/disk >/tmp/ls-lR.dev.disk-flash
```

Now, if you diff the two

```
diff /tmp/ls-lR.dev.disk{,-flash}
```

it should reveal the name of your device. Here it gave

```
$ diff /tmp/ls-lR.dev.disk{,-flash}

3,6c3,6

< drwxr-xr-x 2 root root 620 2007-03-27 14:42 by-id

< drwxr-xr-x 2 root root 420 2007-03-27 14:42 by-label

< drwxr-xr-x 2 root root 660 2007-03-27 14:42 by-path

< drwxr-xr-x 2 root root 520 2007-03-27 14:42 by-uuid

---

> drwxr-xr-x 2 root root 660 2007-03-27 20:26 by-id

> drwxr-xr-x 2 root root 440 2007-03-27 20:26 by-label

> drwxr-xr-x 2 root root 700 2007-03-27 20:26 by-path

> drwxr-xr-x 2 root root 540 2007-03-27 20:26 by-uuid

38a39,40

> lrwxrwxrwx 1 root root  9 2007-03-27 20:26 usb-Kingston_DataTraveler_2.0 -> ../../sdc

> lrwxrwxrwx 1 root root 10 2007-03-27 20:26 usb-Kingston_DataTraveler_2.0-part1 -> ../../sdc1

60a63

> lrwxrwxrwx 1 root root 10 2007-03-27 20:26 usb-storage -> ../../sdc1

63a67,68

> lrwxrwxrwx 1 root root  9 2007-03-27 20:26 pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0 -> ../../sdc

> lrwxrwxrwx 1 root root 10 2007-03-27 20:26 pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0-part1 -> ../../sdc1

116a122

> lrwxrwxrwx 1 root root 10 2007-03-27 20:26 aae93fcf-167f-4a47-bd41-179366b71205 -> ../../sdc1
```

showing the flash disk had been made /dev/sdc with a partition /dev/sdc1.

You can also run blkid (part of e2fsprogs) to get more information

```
# blkid /dev/sdc1

/dev/sdc1: LABEL="usb-storage" UUID="aae93fcf-167f-4a47-bd41-179366b71205" TYPE="ext2"
```

this flash drive has had an ext2 filesystem put on it.

Looking at your posts again, the problem may not be missing filesystem support: it may be that your flash drive isn't being made /dev/sda and therefore mounting /dev/sda1 fails.

----------

## deface

not sure if it solved yet .. but i'd also verify you've got USBFS support in /proc/filesystems

----------

## jyoung

Strangely, I don't have a /dev/disk.  When I diff the results of ls -lR /dev, there is no change when the pendrive is plugged in.  I also checked /proc/filesystems, and usbfs is in there.

----------

## wynn

Two things you might like to try: look at /proc/partitions before and after plugging in the pen drive and see if another block device has showed up.

The second is, having booted and logged in without the pen drive plugged in, run

```
udevcontrol log_priority=debug

tail -f /var/log/messages
```

and then plug in the pen drive.

There should be a welter of output into /var/log/messages amongst which the creation of the device should have an entry.

I put it this way as, without a /dev/disk being created, I am wondering whether udev is running.

If you do get output, then going back through /var/log/messages (and running

```
udevcontrol log_priority=err
```

to turn off the flood) should show what's going on.

----------

## NeddySeagoon

jyoung,

USB Memory sticks come in two sorts, ones that look like hard drives which have a partition table and ones that look like floppies, which don't. For the former, you mount /dev/sda1 (the partition) for the latter, you mount /dev/sda (the raw device)

What sort of USB stick do you have ?

----------

## jyoung

I'm not sure which of those catagories my pen drive would fall under.  Neither /dev/sda nor /dev/sda1 exist on my computer.

----------

## NeddySeagoon

jyoung,

Plug the pen drive in and look. udev creates and removes these /dev nodes as required.

Also check your most recent kernel install. Run 

```
uname -a
```

Is the kernel version correct and is the date/time shown the time of your most recent kernel build ?

----------

## jyoung

Even after I plug the pen drive in, neither /dev/sda1 nor /dev/sda exist.  They are not getting created.

Running "uname -a" returns version 2.6.9, however the date is wrong.  I'm starting to wonder if I'm doing something wrong in recompiling my kernel.

----------

## huuan

I noticed when you referred earlier to recompiling your kernel that you didn't mention the step of copying bzImage across to boot, similar to

cp arch/i386/boot/bzImage /boot/kernel-2.6.17-gentoo-r5

when you are in /usr/src/linux

you probably did that and didn't mention it right?

----------

## jyoung

No I didn't.  Where does that step come in, after I "make" from /usr/src/linux?

----------

## wynn

 *jyoung wrote:*   

> No I didn't.  Where does that step come in, after I "make" from /usr/src/linux?

 The steps to compile and install a kernel and its modules are (for a 2.6.19-gentoo-r5 kernel)

```
cd /usr/src/linux-2.6.19-gentoo-r5

make menuconfig

make && make modules_install

cp -pv arch/i386/boot/bzImage /boot/kernel-2.6.19-gentoo-r5

cp -pv .config /boot/config-2.6.19-gentoo-r5
```

(1) You may need to change "cd /usr/src/linux-2.6.19-gentoo-r5" if you have the source for a different kernel

(2) You can skip the "make menuconfig" step if you don't want to change your kernel configuration.

(3) You will have to change the "i386" in "arch/i386/boot/bzImage" if you have an Intel or AMD 64-bit processor (change to "x86_64" in this case).

(4) Copying .config to your boot directory is just to save it, it doesn't take any part in running the kernel.

----------

## NeddySeagoon

jyoung,

The steps involved in building and installing a kernel are described here

----------

## manny15

If the device file is not getting created, it's possible SCSI support is not available. I believe usb mass-storage uses SCSI emulation.

Kernel Config

```

$ gunzip -c /proc/config.gz|grep "SCSI.*=[m|y]"

CONFIG_BLK_DEV_IDESCSI=m

CONFIG_SCSI=y

CONFIG_SCSI_PROC_FS=y

CONFIG_SCSI_CONSTANTS=y

$ gunzip -c /proc/config.gz|grep "USB.*=[m|y]"

CONFIG_SND_USB_AUDIO=m

CONFIG_USB_ARCH_HAS_HCD=y

CONFIG_USB_ARCH_HAS_OHCI=y

CONFIG_USB_ARCH_HAS_EHCI=y

CONFIG_USB=m

CONFIG_USB_DEVICEFS=y

CONFIG_USB_BANDWIDTH=y

CONFIG_USB_EHCI_HCD=m

CONFIG_USB_UHCI_HCD=m

CONFIG_USB_STORAGE=m

CONFIG_USB_HID=m

CONFIG_USB_HIDINPUT=y

CONFIG_USB_MON=y

```

Kernel Modules

```
$ lsmod|grep "s[g|d]"

sd_mod                 13200  0 

sg                     22812  0

$ lsmod|grep usb     

usb_storage            29828  0

usbhid                 25476  0 

usbcore                93828  6 usb_storage,usbhid,at76_usb,ehci_hcd,uhci_hcd

```

I believe you need CONFIG_BLK_DEV_IDESCSI, CONFIG_SCSI, CONFIG_USB, CONFIG_USB_UHCI_HCD, CONFIG_USB_UHCI_HCD (USB 2.0), and CONFIG_USB_STORAGE.

----------

## jyoung

That did it.  Thanks all.

----------

