# SMF2 to discourse - Troubles importing attachments

**URL:** <https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302>\
**Category:** Support\
**Created:** [June 6, 2018, 9:46pm UTC](https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302 "2018-06-06T21:46:17Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![marcozambi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcozambi/32/119505_2.png) [@marcozambi](https://meta.discourse.org/u/marcozambi)\
**Post date:** [June 6, 2018, 9:46pm UTC](https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302/1 "2018-06-06T21:46:17Z")

</div>

Dear all,  
since a few days I’m working on importing an SMF2 forum content into a brand new install of discourse.

I’ve configured my host following this guide [Use an import script that requires MySQL](https://meta.discourse.org/t/how-to-use-the-bbpress-import-script-or-any-other-import-script-with-mysql-dependency/63349), with a few tweaks to adapt it to SMF2.

My forum is quite big: I have about 283000 posts and 18000 attachments.

My problem is the following:

- if I perform the import from SMF _without_ attachments (I do this simply renaming the attachments directory) then the scripts performs well and I get all my posts (with a ton of error for missing attachments, as expected).
- If I perform the import _with_ the attachments, I get random crashes along the posts’ import. The message I receive is the following:

```plaintext
3093 / 282702 ( 1.1%) [905 items/min] /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/mysql2.rb:8:in `each': Lost connection to MySQL server during query (Mysql2::Error)
        from /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/rack-mini-profiler-1.0.0/lib/patches/db/mysql2.rb:8:in `each'
        from /var/www/discourse/script/import_scripts/base.rb:493:in `create_posts'
        from script/import_scripts/smf2.rb:193:in `import_posts'
        from script/import_scripts/smf2.rb:67:in `execute'
        from /var/www/discourse/script/import_scripts/base.rb:46:in `perform'
        from script/import_scripts/smf2.rb:26:in `run'
        from script/import_scripts/smf2.rb:623:in `<main>'

```

For completeness, I have to add that I mounted the SMF2 attachments directory as a volume in the container. I have the suspicion it might be something related to performances of the mounted volume. If the attachments directory is found and used in the import, the whole process slows down considerably.

My server is pretty beefy, I don’t think this is about the resources available.  
I’m a newbie to ruby and discourse, so I don’t have much to offer here, but asking for some hints or help.

Thanks in advance!

---

_[View the full topic](https://meta.discourse.org/t/smf2-to-discourse-troubles-importing-attachments/89302)._
