# What to do when /dev/sdN not present before reboot?

## jeffk

I have an offsite machine that I was preparing for reboot. It's been running ~amd64 2.6.32-r2 for many months. I went to 'grub install /dev/sda', and found that no /dev/sdN was present.

On this occasion, I have some onsite today help to boot with systemrescuecd, chroot and grub install that way, but I would like to know what would be an effective way to repopulate /dev/sdN if this happens again when I'm without onsite resources.

I have emerged udev multiple times during this uptime; I suppose it could be related that a udev restart doesn't always result in a fully populated /dev.

Any suggestions? Thanks.

Clarification: I am updating to grub2, since I knew I'd have some onsite assistance if things went awry. grub2 has been working great on my other gentoo machines. After I discovered the missing /dev/sdN, downgrading to grub1 doesn't work either. I'd need to have /dev/sda to install either one.

----------

## frostschutz

you mean dev in a chroot?

mount -o bind /dev /mnt/gentoo/dev

----------

## jeffk

 *frostschutz wrote:*   

> you mean dev in a chroot?
> 
> mount -o bind /dev /mnt/gentoo/dev

 

Hi frostschutz. No, I"m in a regular boot, uptime and serving for months. No /dev/sdN present.

```
# ls /dev/sd*

ls: cannot access /dev/sd*: No such file or directory

# ls /dev/sda1

ls: cannot access /dev/sda1: No such file or directory
```

```
# mount

rootfs on / type rootfs (rw)

/dev/sda1 on / type ext4 (rw,relatime,barrier=1,data=ordered)

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

rc-svcdir on /lib64/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)

udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)

shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)

usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)
```

I was hoping there was some way to populate /dev/sda at runtime before I reboot. udev has been emerged (updates) and restarted several times during this uptime, which may have contributed to this runtime state of /dev

My fallback option is to reboot with systemrescuecd, create the chroot, bind /dev, etc. and then issue my 'grub install', and reboot. But then I won't learn a potentially critical troubleshooting method.

Thanks.

----------

## NeddySeagoon

jeffk,

Try mknod.  This makes the static device node(s) that you need.

Be aware that just because the /dev/ entry is present does not mean that there is a physical device attached to it.

You can however, test that before you reboot.

----------

## jeffk

 *NeddySeagoon wrote:*   

> jeffk,
> 
> Try mknod.  This makes the static device node(s) that you need.
> 
> Be aware that just because the /dev/ entry is present does not mean that there is a physical device attached to it.
> ...

 

Thanks for the tip, I was unaware of mknod.

A windstorm power-event forced a reboot while I was researching this, and happily the machine came back up via the grub-0.97 previously installed on /dev/sda.

I'll post the following link and quote for those researching similar situations (i.e. block major and minor numbers):

```
mknod /dev/sda b 8 0

mknod /dev/sda1 b 8 1 
```

http://forum.soft32.com/linux2/lost-dev-sda-dev-sda1-ftopict23185.html

----------

## NeddySeagoon

jeffk,

You also need to check/fix permissions and owner/group.

```
$ ls -l /dev/sda*

brw-rw---- 1 root disk 8, 0 May  8 11:46 /dev/sda

brw-rw---- 1 root disk 8, 1 May  8 11:46 /dev/sda1
```

is correct.

----------

