If you accidentally unmounted the following

tmpfs on /dev type tmpfs (rw,noatime,nodiratime,size=10240k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,nodiratime,mode=600)
/dev/md0 on / type btrfs (rw,noatime,nodiratime,nospace_cache)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime,nodiratime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime,nodiratime)

Accidentally did this:

umount /dev/pts
umount /dev
umount /proc
umount /sys

 

Here is how to get those back:

All of this is from this article: http://git.busybox.net/busybox/plain/docs/mdev.txt

GET SYS and PROC back First
#############################

Here’s a typical code snippet from the init script:

mount -t proc proc /proc
mount -t sysfs sysfs /sys
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s

Alternatively, without procfs the above becomes:

mount -t sysfs sysfs /sys
sysctl -w kernel.hotplug=/sbin/mdev
mdev -s

NOTE: if you dont have mdev, then you will need to recreate each device with mknod. If you dont have mdev, but have udev, then you probably dont need to run anything as it will auto fill /dev with the devices – or you might need to ask udev to restart, or ask udev to re-read its config files to repopulate the /dev field. Here is an article on mknod and udev (and also mdev): mknod,mdev,udev

Get DEV and DEVPTS back Second
##################################

mount -t tmpfs -o size=64k,mode=0755 tmpfs /dev
mkdir /dev/pts
mount -t devpts devpts /dev/pts 
# might need to run after this:
mdev -s

NOTE: you will probably be okay to do “mount -t tmpfs tmpfs /dev” at step4.

Leave a Reply

Your email address will not be published. Required fields are marked *