Migrating Hosts to New Server
-
Hi,
I’m trying to migrate my host list to a new server.
I’ve attempted to export the CSV from the old server, however it puts the CSV in a format that seems broken.
Some of the hosts, the MAC hasn’t exported at all, on the ones that it has, it hasn’t put in any semi colons, so FOG refuses to import them.
I have around 700 hosts and it’s not viable to manually enter the semi colons. I also want to avoid exporting the entire database as there are a lot of different configuration settings on my new server as its a different network environment.
Any advice appreciated.
-
@Critchleyb Just noticed that I have overlooked something myself. You’ll need to export and import MAC address table (don’t forget the MAC address association table).
-
What version of FOG going to what version of FOG?
Is the function broken on the export or import side?
-
Old version was 1.5.0-RC-2
Trying to import to 1.5.5.
I believe the export is what is causing the issue. Has this been tweaked in a later version?
-
@Critchleyb I can’t say for sure. Probably yes since you are even on a RC release.
I was going to recommend a database way to exporting the table, but then I remembered about table dependencies.
So in stead I would recommend that you bring your old FOG server up to 1.5.5. Realize it will function differently than 1.5.0rc2. But the goal is to get the export to work correctly.
- Export your Image definitions first
- Migrate the images raw files (/images) to your new FOG server
- Import your images.csv into your new fog server
- Export your hosts definitions from the old fog server.
- Import the host definitions into your new FOG server.
If you can’t upgrade your old fog server for some reason then can you show us what is doing to the csv file to make it unusable?
-
Thanks, I’ll try that when i’m back in the office tomorrow.
Thankfully I don’t need to transfer the images over, so its a little simpler.
The old server is in use by another team and still needs to carry on working. But hopefully i’ll be able to update it without issues.
-
I also attempted to export the database following this guide but just for the hosts table:
https://wiki.fogproject.org/wiki/index.php?title=Migrate_FOG
using
Old Server:
mysqldump fog hosts > hosts.sql
New Server:
mysql fog < hosts.sql
But no luck with that, it exported fine but when i tried to import no data showed in the web portal.
-
@Critchleyb said:
Some of the hosts, the MAC hasn’t exported at all, on the ones that it has, it hasn’t put in any semi colons
Can you give us a couple of lines of examples on this. Possibly we can make a bit more sense of this. Without knowing what exactly the export looks like, it’s hard to help.
mysqldump fog hosts > hosts.sql
Sounds like a valid road to go but I am wondering what the hosts.sql actually looks like after the export. See if you have any entries in the hosts table after the import:
mysql -e 'SELECT COUNT(*) FROM hosts' fog
-
Hello,
Seems like the data was imported. Count * shows 1193 entries in the table.
No data showing in the hosts list on the web portal however.
-
@Critchleyb Default view in the hosts list is search and does not show any hosts! Sure you clicked on the “List all hosts” link in the left menu? Just wanna make sure.
You can change the default view to list instead of search in FOG Configuration -> FOG Settings …
-
@Critchleyb Just noticed that I have overlooked something myself. You’ll need to export and import MAC address table (don’t forget the MAC address association table).
-
Sorted!
As soon as i imported the hostMAC table they all appeared in the web portal.
For anybody reading in the future:
To Migrate just your Host list, you will need to export both the “hosts” and “hostMAC” tables from the old database using mysqldump, then import them both into the new database. Just doing the hosts table will not make them show in the web portal.