JunOS: How to recover the /var directory in the file system?
Summary:
Hard Disk is seen in the show chassis hardware detail and boot sequence sysctl -a |grep bootdev but missing /var in the show system storage output.
Problem or Goal:
In some cases, the HDD is present in the hardware inventory and boot sequence but the /var directory cannot be seen in the file system while issuing the show system storage command. When the /var (HDD) directory is missing in multiple Routing engines, this might not be a hardware problem and this could easily be recovered using the procedures below. If these steps don’t solve the problem, the Routing Engine may need to be replaced due to a hardware issue.
Below are the symptoms of the problem.
/var is not seen in the ‘show system storage’ output:
re1> show system storage Filesystem Size Used Avail Capacity Mounted on /dev/ad0s1a 865M 109M 687M 14% / devfs 1.0K 1.0K 0B 100% /dev devfs 1.0K 1.0K 0B 100% /dev/ /dev/md0 26M 26M 0B 100% /packages/mnt/jbase /dev/md1 110M 110M 0B 100% /packages/mnt/jkernel-9.0R3.6 /dev/md2 38M 38M 0B 100% /packages/mnt/jpfe-T-9.0R3.6 /dev/md3 3.7M 3.7M 0B 100% /packages/mnt/jdocs-9.0R3.6 /dev/md4 35M 35M 0B 100% /packages/mnt/jroute-9.0R3.6 /dev/md5 10M 10M 0B 100% /packages/mnt/jcrypto-9.0R3.6 /dev/md6 22M 22M 0B 100% /packages/mnt/jpfe-common-9.0R3.6 /dev/md7 2.0G 280K 1.8G 0% /tmp /dev/md8 2.0G 33M 1.8G 2% /mfs /dev/ad0s1e 96M 48K 88M 0% /config procfs 4.0K 4.0K 0B 100% /proc
ad1 (HDD) is listed in the Hardware inventory:
re1> show chassis hardware detail | match "ad|Rou" Routing Engine 0 REV 07 740-008883 P11123903280 RE-4.0 ad0 977 MB SanDisk SDCFJ-1024 019314J0807J2535 Compact Flash ad1 28615 MB FUJITSU MHT2030AR NN6QT52154UB Hard Disk Routing Engine 1 REV 07 740-008883 P11123902797 RE-4.0 ad0 977 MB SanDisk SDCFJ-1024 012013I1807L5405 Compact Flash ad1 28615 MB FUJITSU MHT2030AR NN6QT52155S7 Hard Dis
HDD present in the boot sequence
lab@Centre-re1> start shell % sysctl -a |grep bootdev machdep.guessed_bootdev: 2686451712 machdep.bootdevs: pcmcia-flash,pcmcia-flash-1,compact-flash,disk,lan machdep.nextbootdev: pcmcia-flash machdep.currbootdev: compact-flash
Solution:
The /var can be recovered with the following procedure:
- Boot up RE into single user mod. See steps 1 through 3 of KB1972.
- Issue the command:
fsck -y /dev/ad1s1fa few times to correct any error. - Issue the command:
mount /var - Reboot the RE again to see if
/varcan be successfully mounted on/dev/ad1.
Purpose: