Tag Archives: hard-disk

JUNOS hard-disk recovery

Ok, this is not a full complete hard disk recovery method. I’m simply sharing how I managed to fix my M10 hard disk.

I was upgrading JUNOS form version 8 to 9 when I got a bunch of errors and suddenly the hard disk was no longer available. Unfortunately I did not grab a log when this happened.

When I rebooted the box I was seeing this error on startup:

mfs: /dev/ad1s1b: Device not configured
/dev/ad1s1f: CAN'T CHECK FILE SYSTEM.
/dev/ad1s1f: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
Can't open /dev/ad1s1f: Device not configured

Once the box finally started up via the compact-flash I attempted to run a diagnostics but could not:

root> request chassis routing-engine diagnostics hard-disk
-> Hard disk is absent from the boot list.
Hard disk may have had previous errors, skipping test.

So basically it looks like JUNOS has removed the hard drive from the boot list. How can we stick it back? First you need to log in via root so you get the % prompt. Do NOT go into cli mode yet.

Type:

sysctl -w machdep.bootdevs=pcmcia-flash,compact-flash,disk,lan 

This tells JUNOS to put the boot order back to the default, including the hard drive.

Not reboot the box and it should come back into the boot order. This is what I saw on my boot:

ad0: 1953MB  [3970/16/63] at ata0-master PIO4
ad1: DMA limited to UDMA33
ad1: 11513MB  [23392/16/63] at ata0-slave UDMA33
Mounting root from ufs:/dev/ad0s1a
if_pfe_open: listener socket opened, listening...
Mounted jbase package on /dev/vn0...

So far so good. Once the box is back up go back into root mode and type:

root@% smartd -oe /dev/ad1

Hopefully your drive should be back up. If not you can run some extended smart tests on it. If you’ve lost your partitions you can repartition the disk by first going into cli mode and then:

root> request system partition hard-disk

WARNING:   The hard disk is about to be partitioned.  The contents
WARNING:   of /altroot and /altconfig will be saved and restored.
WARNING:   All other data is at risk.  This is the setup stage, the
WARNING:   partition happens during the next reboot.

Setting up to partition the hard disk ...

WARNING:   A REBOOT IS REQUIRED TO PARTITION THE HARD DISK.  Use the
WARNING:   'request system reboot' command when you are ready to proceed
WARNING:   with the partitioning.  To abort the partition of the hard disk
WARNING:   use the 'request system partition abort' command.


root> request system reboot
Reboot the system ? [yes,no] (no) yes

I had to repartition my disk and rebooted. All looks good:

root> show system storage
Filesystem              Size       Used      Avail  Capacity   Mounted on
/dev/ad0s1a             992M        51M       932M        5%  /
devfs                    16K        16K         0B      100%  /dev/
/dev/vn0                 14M        14M         0B      100%
/packages/mnt/jbase
/dev/vn1                 57M        57M         0B      100%
/packages/mnt/jkernel-8.1-20071208.0
/dev/vn2                6.4M       6.4M         0B      100%
/packages/mnt/jpfe-M10-8.1-20071208.0
/dev/vn3                2.9M       2.9M         0B      100%
/packages/mnt/jdocs-8.1-20071208.0
/dev/vn4                 20M        20M         0B      100%
/packages/mnt/jroute-8.1-20071208.0
/dev/vn5                8.3M       8.3M         0B      100%
/packages/mnt/jcrypto-8.1-20071208.0
/dev/vn6                9.6M       9.6M         0B      100%
/packages/mnt/jpfe-common-8.1-20071208.0
mfs:260                 1.5G       8.0K       1.4G        0%  /tmp
mfs:267                 1.5G       248K       1.4G        0%  /mfs
/dev/ad0s1e             189M       5.0K       187M        0%  /config
procfs                  4.0K       4.0K         0B      100%  /proc
/dev/ad1s1f             7.7G       6.6M       7.1G        0%  /var

After this I went from 8.1 to 9.3 and then to 10.4 and everything looks good :)