How to change the archivepath

184 views
Skip to first unread message

jude...@gmail.com

unread,
Apr 6, 2018, 9:05:38 AM4/6/18
to xnat_discussion
Hello everybody !

I managed to install XNAT 1.7 on ubuntu 16.04, the pipeline engine, and Pyxnat.

However, I have more free space on my virtual machine so I created a new partition to move the entire data / xnat folder.
I tried to follow these directions to change the archive path: https://wiki.xnat.org/documentation/xnat-administration/xnat-setup-first-time-configuration/xnat-setup-options-custom -configuration-settings but without success.

I do not understand where the file is: org / nrg / xdat / preferences / SiteConfigPreferences.java.
Any help will be welcome.

Thank you in advance,

Justine

jude...@gmail.com

unread,
Apr 6, 2018, 9:08:06 AM4/6/18
to xnat_discussion

Herrick, Rick

unread,
Apr 6, 2018, 11:58:08 AM4/6/18
to xnat_di...@googlegroups.com

SiteConfigPreferences.java is one of the source files that goes into XNAT. You can find the most recent released version of this file at:

 

https://bitbucket.org/xnatdev/xdat/src/master/src/main/java/org/nrg/xdat/preferences/SiteConfigPreferences.java

 

But you don’t really need to access that file to set the property: that’s just for reference. You can also accomplish a similar end by calling the siteConfig REST call (this requires an admin account):

 

$ http --session=admin server/xapi/siteConfig

 

This will output a large chunk of JSON that has all of the site configuration preferences and their values.

 

You can get the value for the archivePath alone with a similar call:

 

$ http --session=admin server/xapi/siteConfig/archivePath

HTTP/1.1 200

/data/xnat/archive

 

You can change that value by POSTing to the same URL with the value you want to set as the request body:

 

$ echo /data/xnat/foo | http --session=admin POST server/xapi/siteConfig/archivePath

HTTP/1.1 200 OK

$ http --session=admin server/xapi/siteConfig/archivePath

HTTP/1.1 200 OK

/data/xnat/foo

 

That said, if you already have data in your archive, the absolute path to that archive folder is stored in the database for every resource in your system. This can make it a bit tricky to just move your entire archive to another folder. The main tables that use this are the arc_pathinfo table, which points to the archive, prearchive, cache, and build folders for the site and each project in the system, and xnat_resource, which points to the catalogs or resources of every file stored in there. Your options would be to leave all of your existing data where it is and allow it to be continue to be referenced at that location, but then have all future data stored in your new archive folder, OR move everything to your new location and update the database to use, e.g., /data/xnat/foo in place of /data/xnat/bar. Whichever route you choose you’d need to make sure you test thoroughly on a non-production instance of XNAT!

 

This area is one of the things we’re focused on improving (replacing completely really) in the next major release of XNAT.

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
xnat_discussi...@googlegroups.com.
To post to this group, send email to
xnat_di...@googlegroups.com.
Visit this group at
https://groups.google.com/group/xnat_discussion.
For more options, visit
https://groups.google.com/d/optout.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

jude...@gmail.com

unread,
Apr 7, 2018, 1:44:56 PM4/7/18
to xnat_discussion
Thank you very much for your detailed answer.

I suspected that it was rather complex as manipulation.
In fact, I managed to reinstall XNAT on a new virtual machine much larger than the previous one, but I could not login with admin as user and password. When I try, it searches and sends me back to the homepage. I have absolutely nothing in the logs that indicate a concern and I have also seen discussions about this topic but without success.

do you know what provleme could cause this ??

Thank you very much Rick !!
Justine

Herrick, Rick

unread,
Apr 9, 2018, 10:33:01 AM4/9/18
to xnat_di...@googlegroups.com

What version of XNAT is this happening on? There was a bug in 1.7.1 and 1.7.2 where this happened, but it was fixed in 1.7.3. Have a look at this issue report: there are a couple of ways that a redirect loop like this can happen and the comments describe ways to figure out (hopefully!) what’s causing the redirect you’re seeing.

 

--

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

Phone: +1 (314) 273-1645

    --

    You received this message because you are subscribed to the Google Groups "xnat_discussion" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.

    To post to this group, send email to xnat_di...@googlegroups.com.

    Visit this group at https://groups.google.com/group/xnat_discussion.

    For more options, visit https://groups.google.com/d/optout.

   

jude...@gmail.com

unread,
Apr 10, 2018, 4:21:44 AM4/10/18
to xnat_discussion
I am using the latest version of XNAT (1.7.4.1), when I first installed, I did not experience this problem and therefore do not understand why this is happening now :(

jude...@gmail.com

unread,
Apr 10, 2018, 8:51:29 AM4/10/18
to xnat_discussion
Now it works! I just waited long enough to enter admin default and there was no problem with the loop setup!

Thanks again !!
Justine


Le lundi 9 avril 2018 16:33:01 UTC+2, Rick Herrick a écrit :

Angel Kennedy

unread,
Aug 6, 2019, 4:20:51 AM8/6/19
to xnat_discussion
I am having the same problem. I need to change the archive path due to space issues but cannot just move xnat home because the drive with the needed space does not allow lock files to be created. I tried following the instructions as outlined here (https://wiki.xnat.org/display/XNAT17/XNAT+Setup+Options+-+Custom+Configuration+Settings). It took quite some effort to get it working with the plugin etc. However following the instructions has not actually changed the location of the archive folder. The steps I took are as follows...

1 create a file called site-config.properties
2 Placed it in  pluginDir/src/main/resources/META-INF/xnat/preferences then built using gradlew jar
3 I copied the  xnat-modSettings-plugin-1.0.0-modSettings.jar to {xnat.home}/plugins
4 Restarted the xnat server

The above was all way more complicated than it could have been because I had to work out which version of Gradle would actually find the resources in order to build the template plugin (it wasn't the version I got using sudo apt-get install gradle on Ubuntu 16). I then had to build my own tomcat7 because the binary I could download from the apache website was built with java 1.8 so attempting to start the server with the plugin threw api errors despite my having set Tomcat7 to use java 1.7 and despite having built the plugin in java 1.7 compatibility mode. Having finally gotten all that working I discovered that it didn't matter because XNAT appears to have ignored the path I put in the site-config.properties. I do know that something was happening or there wouldn't have been runtime errors when Tomcat tried to apply the configuration before I rebuilt it using java 1.7. It would be great if anyone knows why this might not have worked or what else I can try.   

With regards to the solution below I'm now doing a tutorial on how to use the XNAT rest API as it seems I can't just plug in the examples below into my browser. It does seem a bit weird that I it would be possible to change this via rest but not through the admin site configuration options. Anyway hopefully that works once I've worked out how to use it.  

To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to
xnat_discussion@googlegroups.com.
Visit this group at
https://groups.google.com/group/xnat_discussion.
For more options, visit
https://groups.google.com/d/optout.

McKay, Mike

unread,
Aug 6, 2019, 10:05:09 AM8/6/19
to xnat_discussion

I believe you just want to create a prefs-override.ini file. It should not require a plugin. See:

https://groups.google.com/d/msg/xnat_discussion/kwEk_eiXN5g/EwgguBbMAQAJ


However, we do not make it easy to change the archive path in the UI because of all the problems that can result from this. You will likely need to make a lot of manual database changes to resolve those issues. Rick's earlier post had a little more information:

"That said, if you already have data in your archive, the absolute path to that archive folder is stored in the database for every resource in your system. This can make it a bit tricky to just move your entire archive to another folder. The main tables that use this are the arc_pathinfo table, which points to the archive, prearchive, cache, and build folders for the site and each project in the system, and xnat_resource, which points to the catalogs or resources of every file stored in there. Your options would be to leave all of your existing data where it is and allow it to be continue to be referenced at that location, but then have all future data stored in your new archive folder, OR move everything to your new location and update the database to use, e.g., /data/xnat/foo in place of /data/xnat/bar. Whichever route you choose you’d need to make sure you test thoroughly on a non-production instance of XNAT!"


-Mike


From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Angel Kennedy <angel.m...@gmail.com>
Sent: Tuesday, August 6, 2019 3:20:50 AM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: Re: [XNAT Discussion] Re: How to change the archivepath
 
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/d869389b-f5a2-4585-a248-1640b81bf223%40googlegroups.com.

Angel Kennedy

unread,
Aug 6, 2019, 10:59:07 PM8/6/19
to xnat_discussion
Hi Mike, thanks for the quick response.

This system has not been released into production yet so if I can work out how to change the settings now then I can re-initialise the database and hopefully xnat will be happy with the new arrangements. I do need to make sure that I can successfully change the archive and prearchive location settings first though. 

I tried creating a prefs-override.ini file. The post you linked to didn't specify where to put this file and one did not already exist in either the xnat war or the xnat home directories. I decided the best place would be in the ${xnat.home}\config directory. I placed the following lines in the file...

archivePath=/data/xnat/storage/archive
prearchivePath=/data/xnat/storage/prearchive

(ultimately the new location will have a different path as the additional storage has limitatations on paths I'm allowed to use so I can't just mount the target directory at /data/xnat/archive for example so that properties in xnat do not have to be modified. I'm jsut testing on the local file system because I want to know that it works this way first because the extra storage is mounted in a more complicated way than usual.) 

the location as specified in CATALINA_OPTS is 
 -Dxnat.home=/data/xnat/home

I restarted xnat and found that if I place the following in the browser 
I get the old location
/data/xnat/archive

If I retrieve all the settings as per the linked post using 
I notice that the old paths are set using the proper names but the new paths are listed with the names of the fields truncated for some reason
eg
archivePath=/data/xnat/archive
but
ePath=/data/xnat/storage/archive 
and
ePath=/data/xnat/storage/prearchive
and
th=/data/xnat/storage/archive

Have I done something wrong in creating the prefs-override.ini file?

I'm having some trouble using the rest calls to set the archive path because 
- the examples provided don't use either curl or the XNATRestClient which I could find instructions for. HTTP doesn't seem to be a linux program. I was getting somewhere translating the calls into XNATRestClient format except that I have SSL setup and my attempts to log in via the XNATRestClient didn't work because it was struggling with certificates. I did try restarting the server without using SSL but for some reason it won't let me log in anymore if I do that. I expect I'll eventually get to the bottom of this but it would be good to know either what program I have to install in ubuntu to use the example commands or what the commands would look like in XNATRestClient as the examples provided in the tutorial don't involve passing configuration settings.  

thanks again for your help
Angel



On Tuesday, 6 August 2019 22:05:09 UTC+8, Mike McKay wrote:

I believe you just want to create a prefs-override.ini file. It should not require a plugin. See:

https://groups.google.com/d/msg/xnat_discussion/kwEk_eiXN5g/EwgguBbMAQAJ


However, we do not make it easy to change the archive path in the UI because of all the problems that can result from this. You will likely need to make a lot of manual database changes to resolve those issues. Rick's earlier post had a little more information:

"That said, if you already have data in your archive, the absolute path to that archive folder is stored in the database for every resource in your system. This can make it a bit tricky to just move your entire archive to another folder. The main tables that use this are the arc_pathinfo table, which points to the archive, prearchive, cache, and build folders for the site and each project in the system, and xnat_resource, which points to the catalogs or resources of every file stored in there. Your options would be to leave all of your existing data where it is and allow it to be continue to be referenced at that location, but then have all future data stored in your new archive folder, OR move everything to your new location and update the database to use, e.g., /data/xnat/foo in place of /data/xnat/bar. Whichever route you choose you’d need to make sure you test thoroughly on a non-production instance of XNAT!"


-Mike


To unsubscribe from this group and stop receiving emails from it, send an email to xnat_di...@googlegroups.com.

Angel Kennedy

unread,
Aug 7, 2019, 3:26:22 AM8/7/19
to xnat_discussion
Well I finally got the value to change by prefixing the field names with six characters in the prefs-override.ini file. 
e.g.
666666archivePath=/data/xnat/storage/archive
666666prearchivePath=/data/xnat/storage/prearchive

finally meant that calling https://server-url/xapi/siteConfig/archivePath returned /data/xnat/storage/archive etc

My concern now is that if clean out the database and launch it all from scratch I don't know what it's going to do with these weirdly named parameter fields. From looking at SiteConfigPreferences.java though it seems that if I set values for the fields in META-INF/xnat/preferences/site-config.properties when setting it up with an empty database it would hopefully pick them up correctly from
there without me prefixing nonsense characters.

I'll let you know how that goes. 

Thanks again for the help. 
Angel

McKay, Mike

unread,
Aug 7, 2019, 9:33:31 AM8/7/19
to xnat_discussion

I didn't see any "[siteConfig]" line in your examples. Did you by chance leave off the section name? I could see that potentially leading to the issues you're encountering. I'm hoping that with that change and a fresh database everything would work the way you want.


-Mike


From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Angel Kennedy <angel.m...@gmail.com>
Sent: Wednesday, August 7, 2019 2:26:21 AM
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/b3a5abbf-2f30-41c0-b117-c083802847f9%40googlegroups.com.

McKay, Mike

unread,
Aug 7, 2019, 9:59:22 AM8/7/19
to xnat_discussion

Also, the location you put the file should be correct.


And if you're referring to the "$ http --session=admin --pretty=format –body https://xnatdev.xnat.org/xapi/prefs/ini" line from Rick's comment, that was to get the prefs, not set them.


If you haven't already played around with it, I recommend checking out Swagger (available at YOUR_SITE/xapi/swagger-ui.html or from the link you can get to via Administer-> Site Administration -> Miscellaneous-> Development Utilities). The Site Config Api section allows you to do preference REST calls in a much more intuitive way (and even converts your REST call into a curl command in case you later want to do it outside of Swagger). Swagger can be very handy for working with an XNAT, though I would still recommend going the fresh database and prefs-override route in this case.


-Mike



From: xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of McKay, Mike <mfm...@wustl.edu>
Sent: Wednesday, August 7, 2019 8:33:26 AM

Tashrif

unread,
Jan 6, 2022, 5:32:00 PM1/6/22
to xnat_discussion
Rick, I couldn't figure your http --session=admin server/xapi/siteConfig/archivePath command for my XNAT running at http://localhost:8080/. So I defined /data/xnat/home/config/prefs-override.ini with:

[siteConfig]
archivePath=/data/xnat/archive
prearchivePath=/data/xnat/prearchive

following https://groups.google.com/g/xnat_discussion/c/kwEk_eiXN5g/m/EwgguBbMAQAJ. I see the changed reflected on XNAT website but I am not sure when it will be upset as noted in the other thread.

-Tashrif

To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to
xnat_di...@googlegroups.com.
Visit this group at
https://groups.google.com/group/xnat_discussion.
For more options, visit
https://groups.google.com/d/optout.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/d869389b-f5a2-4585-a248-1640b81bf223%40googlegroups.com.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/b3a5abbf-2f30-41c0-b117-c083802847f9%40googlegroups.com.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

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