Can I backup netbox

1,533 views
Skip to first unread message

joseph de los santos

unread,
Sep 18, 2020, 1:51:54 AM9/18/20
to NetBox
Hi,

Can I backup netbox data? if so, can someone point me in the right documentation?

Thank you

Brian Candler

unread,
Sep 18, 2020, 2:52:42 AM9/18/20
to NetBox

joseph de los santos

unread,
Sep 18, 2020, 5:19:20 AM9/18/20
to Brian Candler, NetBox
Thank you Sir.

On Fri, Sep 18, 2020 at 2:52 PM Brian Candler <b.ca...@pobox.com> wrote:

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/39f6983d-ed50-4100-aa7a-9e0a9294a6f4o%40googlegroups.com.

joseph de los santos

unread,
Sep 18, 2020, 10:45:46 AM9/18/20
to Brian Candler, NetBox
Oh, another question- if I backup the db and media files will it include all data in the IPAM as well?

Brian Candler

unread,
Sep 18, 2020, 1:17:11 PM9/18/20
to NetBox
Netbox stores all its data in postgres, apart from the media files on the filesystem.  Therefore if you restore postgres, you'll restore everything recorded in Netbox: sites, devices, virtual machines, interfaces, IP addresses, cables etc.

Anders Hagman

unread,
Sep 19, 2020, 2:31:23 AM9/19/20
to joseph de los santos, NetBox
--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.

joseph de los santos

unread,
Sep 20, 2020, 11:01:14 PM9/20/20
to Anders Hagman, NetBox
Guys,

A few questions

1. If I upgrade, will I lose current data and start from scratch?
2. Can I import IPAM data from a different netbox version to latest stable netbox version?
3. Can I import from different netbox instances? (i.e.  rack/device data from netbox1, IPAM from netbox2) and merge both in netbox3?

Thanks

Brian Candler

unread,
Sep 21, 2020, 3:15:44 AM9/21/20
to NetBox
1. Upgrading doesn't lose data.  Follow the upgrade instructions: the step "./upgrade.sh" does several things, one of which is to run the migrations which modify your database to the current schema.  However there's always a risk that something will go wrong, so backup your database first.

2. You can replicate an older netbox version to a newer stable version.  After copying, again run "./upgrade.sh" (or "python3 netbox/manage.py migrate") to modify the database so that it's compatible with the new version.

3. No - unless you write your own tool to do this.  You'll need to renumber conflicting primary keys, and therefore all the foreign key references as well.

joseph de los santos

unread,
Sep 21, 2020, 5:03:28 AM9/21/20
to Brian Candler, NetBox
Can I just use "export" command as a CSV in the old netbox instances and import those into my new netbox?

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.

Brian Candler

unread,
Sep 21, 2020, 5:20:02 AM9/21/20
to NetBox
In general, no.  The CSV export and import formats are not compatible in various ways.  For one example, try exporting and importing cables.  Exporting cables exports device IDs, importing requires device names; and the model/type values used are different.

It might work in some very limited cases.

joseph de los santos

unread,
Sep 21, 2020, 5:33:35 AM9/21/20
to Brian Candler, NetBox
Ok, so what is my best approach if I need to get IPAM data from one netbox,  Racks and device types (I assume I need both to render an SVG image)  from another netbox, and merge all these into a new netbox box?

On Mon, Sep 21, 2020 at 5:20 PM Brian Candler <b.ca...@pobox.com> wrote:
In general, no.  The CSV export and import formats are not compatible in various ways.  For one example, try exporting and importing cables.  Exporting cables exports device IDs, importing requires device names; and the model/type values used are different.

It might work in some very limited cases.

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.

Brian Candler

unread,
Sep 21, 2020, 5:50:25 AM9/21/20
to NetBox
As I already explained, this is not a use case supported by Netbox and you'd have to write your own tool to do this.  Alternatively, you can find some other software which meets your needs better.

The core Netbox data model in this area is:

    ,--------------<
Site ---< Rack ----< Device ----------< Interface ------<
                                                       IPAddress
Cluster -----------< VirtualMachine --< VMInterface ----<

Therefore if you move am IP Addresses from one instance to another, you'll have to carry forward the references to the appropriate Interface/VMInterface objects, which means mapping the Interface ID or VMInterface ID on one Netbox instance to that on another Netbox instance.

Netbox doesn't have any UUID which would allow you to keep the same interface ID on both instances.  You can sometimes match using a combination of device/VM name and interface name, but beware that:

- devices can be unnamed
- even when set, device names are not globally unique (they are unique for a given site+tenant)
- VM names are not globally unique (they are unique for a given cluster+tenant)

Hence the tuple of (site name, tenant name, device name, interface name) will often identify a device interface, but not when the device is unnamed.

joseph de los santos

unread,
Sep 21, 2020, 6:36:47 AM9/21/20
to Brian Candler, NetBox
Ok, given I dont know how to code- so my only option is manually adding each  individual object from the two separate netbox instances to my new netbox

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages