How to increase /bootflash on Nexus 9K

On the old version of N9K, the size for /bootflash was around 7.5G. This size could be an issue with the new version.

Example with the old size :

bash-4.2$ df -h | grep bootflash
/dev/sda4 7.5G 3.2G 4.3G 43% /bootflash
/dev/loop9 190M 1.6M 178M 1% /bootflash/.rpmstore/patching

bash-4.2$ sudo fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 64.0 GB, 64023257088 bytes
255 heads, 63 sectors/track, 7783 cylinders, total 125045424 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1   125045423    62522711+  ee  GPT
Partition 1 does not start on physical sector boundary.

To increase the size, you need to reload the switch.

Note: During this process, you need to format /bootflash. Don’t forget to save your files (Config, Binaries, License, etc.)

Try to backup these files on one USB key to restart quickly after the disk initialization.

During the reload, you need to break the boot with CTRL + C, then enter the command: cmdline recoverymode=1 and then boot on the NXOS image.

Now, you are in loader.

                Loader Version 7.66

loader > cmdline recoverymode=1

loader > boot bootflash:nxos.9.3.5.bin

Security Lock
Booting bootflash:nxos.9.3.5.bin
Trying diskboot
 Filesystem type is ext2fs, partition type 0x83
Image valid


Image Signature verification was Successful.

Boot Time: 9/16/2020  10:49:3

Security Lock
Installing klm_card_index
done
Linking n9k flash devices
creating flash devices BOOT_DEV= sda
INIT: version 2.88 booting
Installing ata_piix module ... done.
Unsquashing rootfs ...
Enabling 8250 serial driver spurious INTs workaround
Installing isan procfs ... done.

Now your are in the mode boot.

Enter the following command to repartition the disk: init system

switch(boot)# ?
Exec commands:
  clear      Reset functions
  config     Enter configuration mode
  copy       Copy from one file to another
  delete     Delete a file or directory
  dir        Directory listing for files
  exit       Exit from the EXEC
  find       Find a file below the current directory
  format     Format disks
  init       Initialize internal disk
  load       Load system image
  load-nxos  Load nxos image
  mkdir      Create new directory
  move       Move files
  no         Disable debugging functions
  pwd        View current directory
  reload     Reboot this supervisor module
  rmdir      Remove existing directory
  show       Show running system information
  sleep      Sleep for the specified number of seconds
  ssh        SSH to another system
  start      Load bash shell
  tail       Display the last part of a file
  telnet     Telnet to another system
  terminal   Set terminal line parameters
  write      Write current configuration

switch(boot)# init system check-filesystem
This command is going to erase your startup-config, licenses as well as the contents of your bootflash:.
Do you want to continue? (y/n)  [n] y
Initializing the system ...
Checking flash ...
Erasing Flash ...
Partitioning ...
Partitioning successfull
Formatting bootloader: ...
mke2fs 1.42.9 (28-Dec-2013)
Checking for bad blocks (read-only test): done
Initializing startup-config and licenses ...
Formatting cfg0: ...
mke2fs 1.42.9 (28-Dec-2013)
Checking for bad blocks (read-only test): done
Formatting cfg1: ...
mke2fs 1.42.9 (28-Dec-2013)
Checking for bad blocks (read-only test): done
Formatting pss: ...
mke2fs 1.42.9 (28-Dec-2013)
Checking for bad blocks (read-only test): done
Formatting plog: ...
mke2fs 1.42.9 (28-Dec-2013)
Checking for bad blocks (read-only test): done
Formatting bootflash: ...
mke2fs 1.42.9 (28-Dec-2013)
Checking for bad blocks (read-only test): done
Formatting logflash: ...
mke2fs 1.42.9 (28-Dec-2013)
Checking for bad blocks (read-only test): done
Mounting ...
mount: can't find /mnt/plog in /etc/fstab
ERROR: cannot mount filesystem
Resetting CMOS to default configuration ...
Reinitializing NVRAM contents ...
Initialization completed.

Now your disk is empty but the size have been increase.

switch(boot)# dir
16384 Sep 16 2020 10:53:54 lost+found/
Usage for bootflash: filesystem
2783354880 bytes used
50802970624 bytes free
53586325504 bytes total

At this time, the best way is to copy the NXOS image from USB or TFTP to bootflash and the reload.