Difference between revisions of "Booting A Juniper Switch From USB"

From Baranoski.ca
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 44: Line 44:
 
If your USB key has an activity LED, you should see it flashing while it boots.
 
If your USB key has an activity LED, you should see it flashing while it boots.
  
If you're looking to destroy the data on the onboard flash, do it with the "dd" command. Note we booted from da1 and are zeroing da0.
+
If you're looking to destroy the data on the onboard flash, do it with the "dd" command. Note we booted from da1 and are zeroing da0. Also note that this thing has 1GB of flash, but I specified 1100MB to ensure that it all got wiped.
 
<PRE style="color:white;background-color:black;font-weight:bold;font-size:1.2em;">
 
<PRE style="color:white;background-color:black;font-weight:bold;font-size:1.2em;">
 
root@:LC:1% cli
 
root@:LC:1% cli
Line 74: Line 74:
 
/dev/da0s2a    /dev/da0s4      /dev/da1s1c    /dev/da1s3d
 
/dev/da0s2a    /dev/da0s4      /dev/da1s1c    /dev/da1s3d
 
root@:LC:1% dd if=/dev/zero of=/dev/da0 bs=1M count=1100
 
root@:LC:1% dd if=/dev/zero of=/dev/da0 bs=1M count=1100
 +
dd: /dev/da0: end of device
 +
1001+0 records in
 +
1000+0 records out
 +
1048576000 bytes transferred in 238.753937 secs (4391869 bytes/sec)
 +
</PRE>
  
 +
You can also use the USB key to reimage the onboard flash:
 +
<PRE style="color:white;background-color:black;font-weight:bold;font-size:1.2em;">
 +
root@:LC:1% cli
 +
root> request system snapshot media internal
 +
fpc1:
 +
--------------------------------------------------------------------------
 +
Clearing current label...
 +
Partitioning internal media (/dev/da0) ...
 +
Partitions on snapshot:
 +
 +
  Partition  Mountpoint  Size    Snapshot argument
 +
      s1a    /altroot    183M    none
 +
      s2a    /          184M    none
 +
      s3d    /var/tmp    369M    none
 +
      s3e    /var        123M    none
 +
      s4d    /config    62M    none
 +
Copying '/dev/da1s1a' to '/dev/da0s1a' .. (this may take a few minutes)
 +
Copying '/dev/da1s2a' to '/dev/da0s2a' .. (this may take a few minutes)
 +
Copying '/dev/da1s3d' to '/dev/da0s3d' .. (this may take a few minutes)
 +
Copying '/dev/da1s4d' to '/dev/da0s4d' .. (this may take a few minutes)
 
</PRE>
 
</PRE>

Latest revision as of 15:15, 8 May 2026

I frequently see Juniper EX2200 and EX3300 switches with faulty flash. If you need to recover or destroy some data from one, or are just looking to play with a dead switch, you can boot it from USB.

You will need a USB key that was created as a recovery disk from a working system. It may also be possible to flash it with a computer and Junos packages.

Insert the USB key and power on the switch.

Press Enter when you see this prompt:

Press Enter to stop auto bootsequencing and to enter loader prompt.

Check that you see two disks with the "lsdev" command:

loader> lsdev
disk devices:
        disk0 - USB storage device 0
        disk1 - USB storage device 1
net devices:
        net0:

Run the "show" command and look for the line that says

loader> show
LINES=24
baudrate=9600
boot.btsq.disable=0
boot.current=upgrade
(omittedfor brevity)
loaddev=disk0:
(omitted for brevity)

Set this to disk1: then save and reboot

loader> set loaddev=disk1:
loader> save
Saving environment to flash... done
loader> reboot
Resetting...

If your USB key has an activity LED, you should see it flashing while it boots.

If you're looking to destroy the data on the onboard flash, do it with the "dd" command. Note we booted from da1 and are zeroing da0. Also note that this thing has 1GB of flash, but I specified 1100MB to ensure that it all got wiped.

root@:LC:1% cli
root> show system storage partitions
fpc1:
--------------------------------------------------------------------------
Boot Media: external (da1)
Active Partition: da1s2a
Backup Partition: da1s1a
Currently booted from: active (da1s2a)

Partitions information:
  Partition  Size   Mountpoint
  s1a        316M   altroot
  s2a        324M   /
  s3d        656M   /var/tmp
  s3e        224M   /var
  s4d        108M   /config

{linecard:1}
root> exit

root@:LC:1% ls /dev/da*
/dev/da0        /dev/da0s2c     /dev/da0s4c     /dev/da1s2      /dev/da1s3e
/dev/da0s1      /dev/da0s3      /dev/da0s4d     /dev/da1s2a     /dev/da1s4
/dev/da0s1a     /dev/da0s3c     /dev/da1        /dev/da1s2c     /dev/da1s4c
/dev/da0s1c     /dev/da0s3d     /dev/da1s1      /dev/da1s3      /dev/da1s4d
/dev/da0s2      /dev/da0s3e     /dev/da1s1a     /dev/da1s3c
/dev/da0s2a     /dev/da0s4      /dev/da1s1c     /dev/da1s3d
root@:LC:1% dd if=/dev/zero of=/dev/da0 bs=1M count=1100
dd: /dev/da0: end of device
1001+0 records in
1000+0 records out
1048576000 bytes transferred in 238.753937 secs (4391869 bytes/sec)

You can also use the USB key to reimage the onboard flash:

root@:LC:1% cli
root> request system snapshot media internal
fpc1:
--------------------------------------------------------------------------
Clearing current label...
Partitioning internal media (/dev/da0) ...
Partitions on snapshot:

  Partition  Mountpoint  Size    Snapshot argument
      s1a    /altroot    183M    none
      s2a    /           184M    none
      s3d    /var/tmp    369M    none
      s3e    /var        123M    none
      s4d    /config     62M     none
Copying '/dev/da1s1a' to '/dev/da0s1a' .. (this may take a few minutes)
Copying '/dev/da1s2a' to '/dev/da0s2a' .. (this may take a few minutes)
Copying '/dev/da1s3d' to '/dev/da0s3d' .. (this may take a few minutes)
Copying '/dev/da1s4d' to '/dev/da0s4d' .. (this may take a few minutes)