ONIE Partition Exists Fix
I recently ran into an issue where I had uninstalled Onyx on my switch and I was trying to reinstall it but couldn’t because I was getting an error. Below is an example of the error.
partition exists - please uninstall first
EXT4-fs (sda3): couldn't mount as ext3 due to feature incompatibilities
cp: write error: No space left on device
There is also another variation of this error that I ran into. Below is an example of that error too.
umount: can't unmount /mnt/onie-boot: Invalid argument
/mnt/onie-boot not mounted
Error: You requested a partition from 1000MiB to 2000MiB (sectors 2048000..4095999).
The closest location we can manage is 1000MiB to 1000MiB (sectors 2047999..2047999).
The issue seems to be that somewhere along the lines the NOS uninstall process left behind a partition or two. To fix this we need to delete them. In this post, I’ll show you step-by-step how to delete the leftover partitions with ONIE.
The Fix
This fix works for the Nvidia/Mellanox switches and will likely work on other ONIE switches however, I’ve only tested this on Nvidia/Mellanox switches.
- Connect to ONIE. I’ll be using a console connection and PuTTY.
- Enter GNU Parted for the disk by running the command
parted /dev/sda
In my case the disk was sda it’s likely the same in most setups.
- Run the
print
command to list the partitions on the disk.
- Make a note of the partitions that exist that are not 1 and 2.
- Exit GNU Parted by running the command
quit
- Unmount any of the partitions that could be mounted by running the command
umount /dev/sda
and the partition number.
In my example, I will run umount/dev/sda3
and umount/dev/sda4
If the partition wasn’t mounted it is normal to get an invalid argument error.
Now that the partitions aren’t mounted we can delete them.
- Run the command
parted /dev/sda
to return to GNU Parted.
- Delete the partition by running the command
rm
and the partition number.
In my example, I will run rm 3
and rm 4
- List the partitions again by running the
print
command to confirm that there are only 2 partitions left.
- Run the command
quit
to exit GNU Parted.
- Now you can resume installing your NOS without issue.
That is all it takes to resolve the ONIE partition exists errors.
Leave a comment