<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lcg.in2p3.fr/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Diarra</id>
	<title>lcgwiki - Contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://lcg.in2p3.fr/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Diarra"/>
	<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/Special:Contributions/Diarra"/>
	<updated>2026-04-20T19:18:45Z</updated>
	<subtitle>Contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=LCGFR_TECHnical_Coordination&amp;diff=7733</id>
		<title>LCGFR TECHnical Coordination</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=LCGFR_TECHnical_Coordination&amp;diff=7733"/>
		<updated>2016-03-03T15:01:12Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* FR Technical Activities &amp;amp; Topics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;[[T2T3:WLCG-T2reports|&amp;lt;span style=&amp;quot;color:#FF0000;&amp;quot;&amp;gt;W-LCG : Tier-2s project reports (Accounting, Site reliability)]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;[[T2T3:SiteAdmins|&amp;lt;span style=&amp;quot;color:#FF0000;&amp;quot;&amp;gt; Pages techniques / Trucs et Astuces des SiteAdmins - SiteAdmins HandBook]]&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://lcg.in2p3.fr/wiki/index.php?title=Incoming_events Incoming Events] / [http://lcg.in2p3.fr/wiki/index.php?title=Past_events Past Events]===&lt;br /&gt;
&lt;br /&gt;
=== [https://atrium.in2p3.fr/nuxeo/nxpath/default/Atrium/Projets/LCG@view_documents?tabIds=%3A&amp;amp;conversationId=0NXMAIN  Documentation ATRIUM] ===&lt;br /&gt;
&lt;br /&gt;
=== Contacts (Mailing list  &amp;amp; Visioconferences) ===&lt;br /&gt;
* &amp;lt;b&amp;gt;Contact : Catherine Biscarat &amp;lt;/b&amp;gt; &lt;br /&gt;
* &amp;lt;b&amp;gt;LCGFR-TECH-L@in2p3.fr mailing list&amp;lt;/b&amp;gt; : http://listserv.in2p3.fr/archives/lcgfr-tech-l.html &amp;lt;br&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;Technical Meetings&amp;lt;/b&amp;gt; : [http://indico.in2p3.fr/categoryDisplay.py?categId=61 Agendas page ]&amp;lt;br&amp;gt;&lt;br /&gt;
To connect the &amp;quot;LCG-France TECH&amp;quot; videoconference or the teleconference, please refer to information attached to the agenda.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://edms.in2p3.fr/file/I-024994/1/AAAA-MM-DD-LCGF-T2T3-CRReunion-Modele.odt Minutes OpenOffice Template]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://edms.in2p3.fr/file/I-024994/1/2006-mm-dd-LCGF-T2T3-CRReunion.doc Minutes Word Template]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== [http://lcg.in2p3.fr/wiki/index.php?title=WLCG_and_EGEE_Baseline  WLCG Baseline]  [https://twiki.cern.ch/twiki/bin/view/LCG/WLCGOperationsMeetings WLCG Operations Meetings] [https://twiki.cern.ch/twiki/bin/view/LCG/WLCGTechnicalForum WLCG Technical Forum] ===&lt;br /&gt;
&lt;br /&gt;
=== [https://forge.in2p3.fr/projects/francegrilles-ops/wiki Wiki Operations France Grilles] ===&lt;br /&gt;
&lt;br /&gt;
=== Working groups ===&lt;br /&gt;
* [http://lcg.in2p3.fr/wiki/index.php?title=T2T3:DPM_Collaboration 2013 - DPM Collaboration]&lt;br /&gt;
* [https://forge.in2p3.fr/projects/francegrilles-ops/wiki/Infrastructure_et_Expertise_Accounting LCG-France / SA1-FR Accounting Working Group =&amp;gt; Infrastructure et Expertise Accounting France Grilles] &lt;br /&gt;
*[https://forge.in2p3.fr/projects/francegrilles-ops/wiki/Infrastructure_et_Expertise_Monitoring LCG-France  / SA1-FR Monitoring Working Group =&amp;gt;  Infrastructure et Expertise Monitoring France Grilles]&lt;br /&gt;
* [[WLCGBenchmarkingGroup|WLCG Benchmarking Group]]&lt;br /&gt;
&lt;br /&gt;
=== FR Technical Activities &amp;amp; Topics   ===&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=ALICE_native_xrootd 2015 - Decommissioning ALICE native xrootd servers and dealing with data loss]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=HT-Condor 2015 - Démarrer avec HT-Condor]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=CPUStorageBenchmarking 2015 - CPU and Storage benchmarking]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=MultiCoreAccounting 2014 - Accounting with Multicore]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=Network_Monitoring 2014 - Network Monitoring]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=Scheduler 2013 - Cluster Scheduler Tuning]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=TEG 2011 - WLCG Technology Evolution Group]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=MUPJ 2010 - Support of Multi-User Pilot Jobs]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=TCP-Tuning Linux Kernel Tuning: TCP &amp;amp; disk I/O]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=LCG-FR_/_SA1-FR_Accounting_WG#Documents_accounting_nominatif 2009 - User-level Accounting]&lt;br /&gt;
&lt;br /&gt;
*[https://edms.in2p3.fr/document/I-008535/2 2008 - Contacts with Hardware providers]&lt;br /&gt;
&lt;br /&gt;
=== Archives ===&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=User_talk:Barbet Wiki JM.Barbet]&lt;br /&gt;
*[https://twiki.cern.ch/twiki/bin/view/LCG/WLCGTEGOperations 2011 - WLCG TEG (Techno. Evol. Groups)]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=User_talk:LEROY Wiki C.Leroy]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=CCRC08  CCRC&#039;08 follow-up]&lt;br /&gt;
*[http://lcg.in2p3.fr/wiki/index.php?title=CPU-Benches 2007 - CPU benches] according to [http://www.cern.ch/LCG/documents/Processor%20performance%20metrics_26may07.pdf CPU Capacity Metrics for WLCG]&lt;br /&gt;
*[[T2T3:2006Q2:Tests T1-T2T3| Tests de débit entre le CC et les sites Tier 2 et Tier 3 (2006) ]]&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7732</id>
		<title>TCP-Tuning</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7732"/>
		<updated>2016-03-03T14:54:46Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Kernel tuning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= TCP Performance =&lt;br /&gt;
&lt;br /&gt;
This page describes how to enhance the performance of data transfers. It mainly focus on the optimization of the Linux kernel parameters.&lt;br /&gt;
&lt;br /&gt;
== Quattor ==&lt;br /&gt;
&lt;br /&gt;
The [http://lcg.in2p3.fr/wiki/images/Quattor_tcp_tuning.pdf Quattor TCP Tuning guide] aims to be a good documentation for helping you tuning your TCP Performance with Quattor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
The following parameters are important for TCP tuning:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They can be modified:&lt;br /&gt;
* By directly passing the parameter to the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This method is useful for testing a parameter, as the modification will not persist after the next reboot.&lt;br /&gt;
* By adding the parameter to the &amp;lt;code&amp;gt;/etc/sysctl.conf&amp;lt;/code&amp;gt; file and loading it with the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This way is interesting when you want to preserve the modification over a reboot.&lt;br /&gt;
&lt;br /&gt;
The following values are recommended:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog = 10000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* http://fasterdata.es.net/&lt;br /&gt;
* http://monalisa.cern.ch/FDT/documentation_syssettings.html&lt;br /&gt;
* http://indico.cern.ch/contributionDisplay.py?sessionId=31&amp;amp;amp;contribId=55&amp;amp;amp;confId=61917&lt;br /&gt;
* http://www.psc.edu/networking/projects/tcptune/&lt;br /&gt;
* http://onlamp.com/pub/a/onlamp/2005/11/17/tcp_tuning.html&lt;br /&gt;
* http://en.wikipedia.org/wiki/TCP_tuning&lt;br /&gt;
&lt;br /&gt;
= Tuning disk I/O =&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
Le fait d&#039;ajuster quelques paramètres du kernel permet d&#039;améliorer les performances au niveau des I/O disques. Le tuning doit être fait au niveau des block devices après chaque reboot du serveur. Ce tuning peut être très utile sur les serveurs de fichiers (DPM disk servers, xrootd servers, ...).&lt;br /&gt;
&lt;br /&gt;
Voici les valeurs recommandées pour un disque /dev/sdb par exemple :&lt;br /&gt;
&lt;br /&gt;
* getra : 16384&lt;br /&gt;
* queue_depth : 256&lt;br /&gt;
* nr_requests : 512&lt;br /&gt;
* scheduler : deadline (au lieu de cfq)&lt;br /&gt;
&lt;br /&gt;
Pour lire les valeurs actuelles de votre serveur pour le disque /dev/sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev --getra /dev/sdb&lt;br /&gt;
cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exemple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# blockdev --getra /dev/sdb&lt;br /&gt;
16384&lt;br /&gt;
# cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
256&lt;br /&gt;
# cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
512&lt;br /&gt;
# cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
noop anticipatory [deadline] cfq &lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour faire le tuning des I/O pour le disque sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev=sdb&lt;br /&gt;
blockdev --setra 16384 /dev/${blockdev}&lt;br /&gt;
echo 512 &amp;gt; /sys/block/${blockdev}/queue/nr_requests&lt;br /&gt;
echo deadline &amp;gt; /sys/block/${blockdev}/queue/scheduler&lt;br /&gt;
echo 256 &amp;gt; /sys/block/${blockdev}/device/queue_depth&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le plus simple est de faire un script qui boucle sur tous les &#039;block devices&#039; à tuner et d&#039;ajuster les paramètres kernel pour chaque disque.&lt;br /&gt;
&lt;br /&gt;
N.B.: chaque site peut tester éventuelement d&#039;autres valeurs et benchmarker pour trouver les valeurs appropriées pour ses serveurs.&lt;br /&gt;
&lt;br /&gt;
Une remarque concernant queue_depth: selon le modèle de serveur, il y a une valeur max qui ne peut être dépassée. Si on essaye d&#039;affecter une valeur plus grande, c&#039;est la valeur max possible qui sera affectée à queue_depth.&lt;br /&gt;
&lt;br /&gt;
Par exemple sur un SUN X4500 si vous faites &amp;quot;echo 256 &amp;gt; /sys/block/sda/device/queue_depth&amp;quot;, vous aurez en fait 31 (la valeur max autorisée) dans queue_depth.&lt;br /&gt;
&lt;br /&gt;
Voici le script que je lance automatiquement à l&#039;IPNO sur chaque disk server après le boot (je ne suis pas sur qu&#039;il est universel et il a été écrit il y a des années). A tester voir s&#039;il peut marcher chez vous:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[root@ipngridxrd2 bin]# pwd&lt;br /&gt;
/usr/local/bin&lt;br /&gt;
[root@ipngridxrd2 bin]# cat tune_disks_io.sh &lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
function f_get_disks_list {&lt;br /&gt;
  # Obtenir la liste des disques de donnes&lt;br /&gt;
  # Je suppose qu&#039;il n&#039;y a pas de melange RAID linux (/dev/mdXX) et hardware (/dev/sdXX) sur la meme machine&lt;br /&gt;
&lt;br /&gt;
  # On supprime les disques systemes de la liste fournie par df&lt;br /&gt;
  # Liste des disks avec le type de fs (xfs, ext3, ext4)&lt;br /&gt;
  local l_disks_type_list=$(df -P -T |egrep -v &amp;quot;Filesystem|\/$|\/opt|\/tmp|\/var|\/usr|\/boot|tmpfs|varvol|tmpvol|usrvol|optvol&amp;quot; |egrep &#039;xfs|ext4|ext3&#039; | awk &#039;{print $1 &amp;quot; &amp;quot; $2 }&#039;)&lt;br /&gt;
  echo  ${l_disks_type_list}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function f_tune_io {&lt;br /&gt;
  # Usage : f_tune_io block_device&lt;br /&gt;
  # Exemple : f_tune_io.sh sdb&lt;br /&gt;
  [ $# != 1 ] &amp;amp;&amp;amp; echo &amp;quot;Usage: f_tune_io block_device&amp;quot; &amp;amp;&amp;amp; return 1&lt;br /&gt;
  local blockdev=$1&lt;br /&gt;
  #echo ${blockdev}&lt;br /&gt;
  echo &amp;quot;....................... Avant le tuning ..........................&amp;quot;&lt;br /&gt;
  f_check_tune ${blockdev}&lt;br /&gt;
  QUEUE_DEPTH=$(cat /sys/block/${blockdev}/device/queue_depth)&lt;br /&gt;
  [ $QUEUE_DEPTH -lt 128 ] &amp;amp;&amp;amp; QUEUE_DEPTH=128 # si c&#039;est plus grand on le garde&lt;br /&gt;
  dmidecode  -s system-product-name | egrep -q &#039;Sun Fire X4500&#039;&lt;br /&gt;
  [ $? -eq 0 ] &amp;amp;&amp;amp; QUEUE_DEPTH=31&lt;br /&gt;
  dmidecode  -s system-product-name | egrep -q &#039;Sun Fire X4540&#039;&lt;br /&gt;
  [ $? -eq 0 ] &amp;amp;&amp;amp; QUEUE_DEPTH=127&lt;br /&gt;
  echo ${QUEUE_DEPTH} &amp;gt; /sys/block/${blockdev}/device/queue_depth # 31 sur les SUN X4500, 128 ou 256 sur Dell&lt;br /&gt;
  echo 512 &amp;gt; /sys/block/${blockdev}/queue/nr_requests  #   (au lieu de 128)&lt;br /&gt;
  echo deadline &amp;gt; /sys/block/${blockdev}/queue/scheduler #(au lieu de cfq)&lt;br /&gt;
  blockdev --setra 16384 /dev/${blockdev} #(au lieu de 256)&lt;br /&gt;
  echo &amp;quot;....................... Apres le tuning ..........................&amp;quot;&lt;br /&gt;
  f_check_tune ${blockdev}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function f_tune_md_io {&lt;br /&gt;
  # Usage : f_tune_md_io md_device&lt;br /&gt;
  # Exemple : f_tune_md_io .sh md11&lt;br /&gt;
  [ $# != 1 ] &amp;amp;&amp;amp; echo &amp;quot;Usage: $0 md_device. Exemple: f_tune_md_io md11&amp;quot; &amp;amp;&amp;amp; return 1&lt;br /&gt;
&lt;br /&gt;
  local mddev=$1&lt;br /&gt;
  echo &amp;quot;+++++++++++++++++++++++++ MD DEVICE = ${mddev} +++++++++++++++++++++++&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  local disks=$(mdadm --query --detail /dev/${mddev}|grep &#039;active sync&#039;|awk &#039;{print $NF}&#039;)&lt;br /&gt;
  local i&lt;br /&gt;
  local j&lt;br /&gt;
  for i in ${disks}; do&lt;br /&gt;
    # /dev/sde1 deviendra sde&lt;br /&gt;
    j=$(echo $i | awk -F/ &#039;{print $NF}&#039;) # /dev/sde1 ==&amp;gt; sde1&lt;br /&gt;
    j=${j%%[0-9]}                     # sde1 ==&amp;gt; sde&lt;br /&gt;
    echo &amp;quot;Tuning ${j} .....................................................&amp;quot;&lt;br /&gt;
    f_tune_io $j&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function f_check_tune {&lt;br /&gt;
  # Usage : f_check_tune block_device&lt;br /&gt;
  # Exemple : f_check_tune sdb&lt;br /&gt;
  [ $# != 1 ] &amp;amp;&amp;amp; echo &amp;quot;Usage: f_check_tune block_device. Exemple: f_check_tune sdb&amp;quot; &amp;amp;&amp;amp; return 1&lt;br /&gt;
&lt;br /&gt;
  local i=$1&lt;br /&gt;
&lt;br /&gt;
  echo -n &amp;quot;blockdev --getra /dev/$i : &amp;quot;&lt;br /&gt;
  blockdev --getra /dev/$i&lt;br /&gt;
  echo -n &amp;quot;cat /sys/block/$i/device/queue_depth : &amp;quot;&lt;br /&gt;
  cat /sys/block/$i/device/queue_depth&lt;br /&gt;
  echo -n &amp;quot;cat /sys/block/$i/queue/nr_requests : &amp;quot;&lt;br /&gt;
  cat /sys/block/$i/queue/nr_requests&lt;br /&gt;
  echo -n &amp;quot;cat /sys/block/$i/queue/scheduler : &amp;quot;&lt;br /&gt;
  cat /sys/block/$i/queue/scheduler&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Debut tuning&lt;br /&gt;
echo &amp;quot; ======= I/O tuning : $(date) ======= &amp;quot;&lt;br /&gt;
disks_type_list=$(f_get_disks_list) &lt;br /&gt;
disks_list=$(echo ${disks_type_list} | sed -e &#039;s/\b\(xfs\|ext4\|ext3\)\b//g&#039; |sort -u)&lt;br /&gt;
echo ${disks_list}&lt;br /&gt;
&lt;br /&gt;
#NB: effet su sed :remplace par exemple /dev/sda1 par sda&lt;br /&gt;
sd_devices=$(echo ${disks_list} | grep &amp;quot;\/dev\/sd&amp;quot; | sed &#039;s/\(\/dev\/\|[0-9]\)//g&#039; | tr &#039;[:space:]&#039; &amp;quot;\n&amp;quot; | sort -u | tr &amp;quot;\n&amp;quot; &amp;quot; &amp;quot;)&lt;br /&gt;
#NB: effet su sed :remplace par exemple /dev/md11 par md11&lt;br /&gt;
md_devices=$(echo ${disks_list} | grep &amp;quot;\/dev\/md&amp;quot; | sed &#039;s/\/dev\///g&#039;)&lt;br /&gt;
lvm_devices=$(echo ${disks_list} | grep &amp;quot;\/dev\/mapper&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;sd_devices = ${sd_devices}&amp;quot;&lt;br /&gt;
echo &amp;quot;md_devices = ${md_devices}&amp;quot;&lt;br /&gt;
echo &amp;quot;lvm_devices = ${lvm_devices}&amp;quot;&lt;br /&gt;
[ ! -z &amp;quot;${sd_devices}&amp;quot; ] &amp;amp;&amp;amp; for d in ${sd_devices}; do&lt;br /&gt;
  echo f_tune_io ${d}&lt;br /&gt;
  f_tune_io ${d}&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
[ ! -z &amp;quot;${md_devices}&amp;quot; ] &amp;amp;&amp;amp; for d in ${md_devices}; do&lt;br /&gt;
  echo f_tune_md_io ${d}&lt;br /&gt;
  f_tune_md_io ${d}&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Rechercher les VG puis les PV et les disque entiers puis tuner&lt;br /&gt;
#[ ! -z &amp;quot;${lvm_devices}&amp;quot; ] &amp;amp;&amp;amp; for d in ${lvm_devices}; do&lt;br /&gt;
#  echo &amp;quot;tune_lvm_io ${d} not implemented yet&amp;quot;&lt;br /&gt;
#done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-io.html&lt;br /&gt;
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-fs.html&lt;br /&gt;
* http://www.gluster.org/community/documentation/index.php/Linux_Kernel_Tuning&lt;br /&gt;
* http://insights.oetiker.ch/linux/raidoptimization/&lt;br /&gt;
* http://mylabfr.kaminoweb.com/increase-disk-queue-depth-on-linux/&lt;br /&gt;
* http://www.redhat.com/magazine/008jun05/features/schedulers/&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7728</id>
		<title>TCP-Tuning</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7728"/>
		<updated>2016-02-26T11:52:02Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* External links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= TCP Performance =&lt;br /&gt;
&lt;br /&gt;
This page describes how to enhance the performance of data transfers. It mainly focus on the optimization of the Linux kernel parameters.&lt;br /&gt;
&lt;br /&gt;
== Quattor ==&lt;br /&gt;
&lt;br /&gt;
The [http://lcg.in2p3.fr/wiki/images/Quattor_tcp_tuning.pdf Quattor TCP Tuning guide] aims to be a good documentation for helping you tuning your TCP Performance with Quattor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
The following parameters are important for TCP tuning:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They can be modified:&lt;br /&gt;
* By directly passing the parameter to the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This method is useful for testing a parameter, as the modification will not persist after the next reboot.&lt;br /&gt;
* By adding the parameter to the &amp;lt;code&amp;gt;/etc/sysctl.conf&amp;lt;/code&amp;gt; file and loading it with the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This way is interesting when you want to preserve the modification over a reboot.&lt;br /&gt;
&lt;br /&gt;
The following values are recommended:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog = 10000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* http://fasterdata.es.net/&lt;br /&gt;
* http://monalisa.cern.ch/FDT/documentation_syssettings.html&lt;br /&gt;
* http://indico.cern.ch/contributionDisplay.py?sessionId=31&amp;amp;amp;contribId=55&amp;amp;amp;confId=61917&lt;br /&gt;
* http://www.psc.edu/networking/projects/tcptune/&lt;br /&gt;
* http://onlamp.com/pub/a/onlamp/2005/11/17/tcp_tuning.html&lt;br /&gt;
* http://en.wikipedia.org/wiki/TCP_tuning&lt;br /&gt;
&lt;br /&gt;
= Tuning disk I/O =&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
Le fait d&#039;ajuster quelques paramètres du kernel permet d&#039;améliorer les performances au niveau des I/O disques. Le tuning doit être fait au niveau des block devices après chaque reboot du serveur. Ce tuning peut être très utile sur les serveurs de fichiers (DPM disk servers, xrootd servers, ...).&lt;br /&gt;
&lt;br /&gt;
Voici les valeurs recommandées pour un disque /dev/sdb par exemple :&lt;br /&gt;
&lt;br /&gt;
* getra : 16384&lt;br /&gt;
* queue_depth : 256&lt;br /&gt;
* nr_requests : 512&lt;br /&gt;
* scheduler : deadline (au lieu de cfq)&lt;br /&gt;
&lt;br /&gt;
Pour lire les valeurs actuelles de votre serveur pour le disque /dev/sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev --getra /dev/sdb&lt;br /&gt;
cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exemple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# blockdev --getra /dev/sdb&lt;br /&gt;
16384&lt;br /&gt;
# cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
256&lt;br /&gt;
# cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
512&lt;br /&gt;
# cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
noop anticipatory [deadline] cfq &lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour faire le tuning des I/O pour le disque sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev=sdb&lt;br /&gt;
blockdev --setra 16384 /dev/${blockdev}&lt;br /&gt;
echo 512 &amp;gt; /sys/block/${blockdev}/queue/nr_requests&lt;br /&gt;
echo deadline &amp;gt; /sys/block/${blockdev}/queue/scheduler&lt;br /&gt;
echo 256 &amp;gt; /sys/block/${blockdev}/device/queue_depth&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le plus simple est de faire un script qui boucle sur tous les &#039;block devices&#039; à tuner et d&#039;ajuster les paramètres kernel pour chaque disque.&lt;br /&gt;
&lt;br /&gt;
N.B.: chaque site peut tester éventuelement d&#039;autres valeurs et benchmarker pour trouver les valeurs appropriées pour ses serveurs.&lt;br /&gt;
&lt;br /&gt;
Une remarque concernant queue_depth: selon le modèle de serveur, il y a une valeur max qui ne peut être dépassée. Si on essaye d&#039;affecter une valeur plus grande, c&#039;est la valeur max possible qui sera affectée à queue_depth.&lt;br /&gt;
&lt;br /&gt;
Par exemple sur un SUN X4500 si vous faites &amp;quot;echo 256 &amp;gt; /sys/block/sda/device/queue_depth&amp;quot;, vous aurez en fait 31 (la valeur max autorisée) dans queue_depth.&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-io.html&lt;br /&gt;
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-fs.html&lt;br /&gt;
* http://www.gluster.org/community/documentation/index.php/Linux_Kernel_Tuning&lt;br /&gt;
* http://insights.oetiker.ch/linux/raidoptimization/&lt;br /&gt;
* http://mylabfr.kaminoweb.com/increase-disk-queue-depth-on-linux/&lt;br /&gt;
* http://www.redhat.com/magazine/008jun05/features/schedulers/&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7727</id>
		<title>TCP-Tuning</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7727"/>
		<updated>2016-02-26T11:16:32Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Kernel tuning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= TCP Performance =&lt;br /&gt;
&lt;br /&gt;
This page describes how to enhance the performance of data transfers. It mainly focus on the optimization of the Linux kernel parameters.&lt;br /&gt;
&lt;br /&gt;
== Quattor ==&lt;br /&gt;
&lt;br /&gt;
The [http://lcg.in2p3.fr/wiki/images/Quattor_tcp_tuning.pdf Quattor TCP Tuning guide] aims to be a good documentation for helping you tuning your TCP Performance with Quattor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
The following parameters are important for TCP tuning:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They can be modified:&lt;br /&gt;
* By directly passing the parameter to the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This method is useful for testing a parameter, as the modification will not persist after the next reboot.&lt;br /&gt;
* By adding the parameter to the &amp;lt;code&amp;gt;/etc/sysctl.conf&amp;lt;/code&amp;gt; file and loading it with the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This way is interesting when you want to preserve the modification over a reboot.&lt;br /&gt;
&lt;br /&gt;
The following values are recommended:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog = 10000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* http://fasterdata.es.net/&lt;br /&gt;
* http://monalisa.cern.ch/FDT/documentation_syssettings.html&lt;br /&gt;
* http://indico.cern.ch/contributionDisplay.py?sessionId=31&amp;amp;amp;contribId=55&amp;amp;amp;confId=61917&lt;br /&gt;
* http://www.psc.edu/networking/projects/tcptune/&lt;br /&gt;
* http://onlamp.com/pub/a/onlamp/2005/11/17/tcp_tuning.html&lt;br /&gt;
* http://en.wikipedia.org/wiki/TCP_tuning&lt;br /&gt;
&lt;br /&gt;
= Tuning disk I/O =&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
Le fait d&#039;ajuster quelques paramètres du kernel permet d&#039;améliorer les performances au niveau des I/O disques. Le tuning doit être fait au niveau des block devices après chaque reboot du serveur. Ce tuning peut être très utile sur les serveurs de fichiers (DPM disk servers, xrootd servers, ...).&lt;br /&gt;
&lt;br /&gt;
Voici les valeurs recommandées pour un disque /dev/sdb par exemple :&lt;br /&gt;
&lt;br /&gt;
* getra : 16384&lt;br /&gt;
* queue_depth : 256&lt;br /&gt;
* nr_requests : 512&lt;br /&gt;
* scheduler : deadline (au lieu de cfq)&lt;br /&gt;
&lt;br /&gt;
Pour lire les valeurs actuelles de votre serveur pour le disque /dev/sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev --getra /dev/sdb&lt;br /&gt;
cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exemple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# blockdev --getra /dev/sdb&lt;br /&gt;
16384&lt;br /&gt;
# cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
256&lt;br /&gt;
# cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
512&lt;br /&gt;
# cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
noop anticipatory [deadline] cfq &lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour faire le tuning des I/O pour le disque sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev=sdb&lt;br /&gt;
blockdev --setra 16384 /dev/${blockdev}&lt;br /&gt;
echo 512 &amp;gt; /sys/block/${blockdev}/queue/nr_requests&lt;br /&gt;
echo deadline &amp;gt; /sys/block/${blockdev}/queue/scheduler&lt;br /&gt;
echo 256 &amp;gt; /sys/block/${blockdev}/device/queue_depth&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le plus simple est de faire un script qui boucle sur tous les &#039;block devices&#039; à tuner et d&#039;ajuster les paramètres kernel pour chaque disque.&lt;br /&gt;
&lt;br /&gt;
N.B.: chaque site peut tester éventuelement d&#039;autres valeurs et benchmarker pour trouver les valeurs appropriées pour ses serveurs.&lt;br /&gt;
&lt;br /&gt;
Une remarque concernant queue_depth: selon le modèle de serveur, il y a une valeur max qui ne peut être dépassée. Si on essaye d&#039;affecter une valeur plus grande, c&#039;est la valeur max possible qui sera affectée à queue_depth.&lt;br /&gt;
&lt;br /&gt;
Par exemple sur un SUN X4500 si vous faites &amp;quot;echo 256 &amp;gt; /sys/block/sda/device/queue_depth&amp;quot;, vous aurez en fait 31 (la valeur max autorisée) dans queue_depth.&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-io.html&lt;br /&gt;
* http://www.gluster.org/community/documentation/index.php/Linux_Kernel_Tuning&lt;br /&gt;
* http://insights.oetiker.ch/linux/raidoptimization/&lt;br /&gt;
* http://mylabfr.kaminoweb.com/increase-disk-queue-depth-on-linux/&lt;br /&gt;
* http://www.redhat.com/magazine/008jun05/features/schedulers/&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7726</id>
		<title>TCP-Tuning</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7726"/>
		<updated>2016-02-26T11:16:17Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Kernel tuning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= TCP Performance =&lt;br /&gt;
&lt;br /&gt;
This page describes how to enhance the performance of data transfers. It mainly focus on the optimization of the Linux kernel parameters.&lt;br /&gt;
&lt;br /&gt;
== Quattor ==&lt;br /&gt;
&lt;br /&gt;
The [http://lcg.in2p3.fr/wiki/images/Quattor_tcp_tuning.pdf Quattor TCP Tuning guide] aims to be a good documentation for helping you tuning your TCP Performance with Quattor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
The following parameters are important for TCP tuning:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They can be modified:&lt;br /&gt;
* By directly passing the parameter to the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This method is useful for testing a parameter, as the modification will not persist after the next reboot.&lt;br /&gt;
* By adding the parameter to the &amp;lt;code&amp;gt;/etc/sysctl.conf&amp;lt;/code&amp;gt; file and loading it with the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This way is interesting when you want to preserve the modification over a reboot.&lt;br /&gt;
&lt;br /&gt;
The following values are recommended:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog = 10000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* http://fasterdata.es.net/&lt;br /&gt;
* http://monalisa.cern.ch/FDT/documentation_syssettings.html&lt;br /&gt;
* http://indico.cern.ch/contributionDisplay.py?sessionId=31&amp;amp;amp;contribId=55&amp;amp;amp;confId=61917&lt;br /&gt;
* http://www.psc.edu/networking/projects/tcptune/&lt;br /&gt;
* http://onlamp.com/pub/a/onlamp/2005/11/17/tcp_tuning.html&lt;br /&gt;
* http://en.wikipedia.org/wiki/TCP_tuning&lt;br /&gt;
&lt;br /&gt;
= Tuning disk I/O =&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
Le fait d&#039;ajuster quelques paramètres du kernel permet d&#039;améliorer les performances au niveau des I/O disques. Le tuning doit être fait au niveau des block devices après chaque reboot du serveur. Ce tuning peut être très utile sur les serveurs de fichiers (DPM disk servers, xrootd servers, ...).&lt;br /&gt;
&lt;br /&gt;
Voici les valeurs recommandées pour un disque /dev/sdb par exemple :&lt;br /&gt;
&lt;br /&gt;
* getra : 16384&lt;br /&gt;
* queue_depth : 256&lt;br /&gt;
* nr_requests : 512&lt;br /&gt;
* scheduler : deadline (au lieu de cfq)&lt;br /&gt;
&lt;br /&gt;
Pour lire les valeurs actuelles de votre serveur pour le disque /dev/sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev --getra /dev/sdb&lt;br /&gt;
cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exemple:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# blockdev --getra /dev/sdb&lt;br /&gt;
16384&lt;br /&gt;
# cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
256&lt;br /&gt;
# cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
512&lt;br /&gt;
# cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
noop anticipatory [deadline] cfq &lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour faire le tuning des I/O pour le disque sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev=sdb&lt;br /&gt;
blockdev --setra 16384 /dev/${blockdev}&lt;br /&gt;
echo 512 &amp;gt; /sys/block/${blockdev}/queue/nr_requests&lt;br /&gt;
echo deadline &amp;gt; /sys/block/${blockdev}/queue/scheduler&lt;br /&gt;
echo 256 &amp;gt; /sys/block/${blockdev}/device/queue_depth&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le plus simple est de faire un script qui boucle sur tous les &#039;block devices&#039; à tuner et d&#039;ajuster les paramètres kernel pour chaque disque.&lt;br /&gt;
&lt;br /&gt;
N.B.: chaque site peut tester éventuelement d&#039;autres valeurs et benchmarker pour trouver les valeurs appropriées pour ses serveurs.&lt;br /&gt;
&lt;br /&gt;
Une remarque concernant queue_depth: selon le modèle de serveur, il y a une valeur max qui ne peut être dépassée. Si on essaye d&#039;affecter une valeur plus grande, c&#039;est la valeur max possible qui sera affectée à queue_depth.&lt;br /&gt;
&lt;br /&gt;
Par exemple sur un SUN X4500 si vous faites &amp;quot;echo 256 &amp;gt; /sys/block/sda/device/queue_depth&amp;quot;, vous aurez en fait 31 (la valeur max autorisée) dans queue_depth.&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-io.html&lt;br /&gt;
* http://www.gluster.org/community/documentation/index.php/Linux_Kernel_Tuning&lt;br /&gt;
* http://insights.oetiker.ch/linux/raidoptimization/&lt;br /&gt;
* http://mylabfr.kaminoweb.com/increase-disk-queue-depth-on-linux/&lt;br /&gt;
* http://www.redhat.com/magazine/008jun05/features/schedulers/&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7725</id>
		<title>TCP-Tuning</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=TCP-Tuning&amp;diff=7725"/>
		<updated>2016-02-26T11:15:34Z</updated>

		<summary type="html">&lt;p&gt;Diarra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= TCP Performance =&lt;br /&gt;
&lt;br /&gt;
This page describes how to enhance the performance of data transfers. It mainly focus on the optimization of the Linux kernel parameters.&lt;br /&gt;
&lt;br /&gt;
== Quattor ==&lt;br /&gt;
&lt;br /&gt;
The [http://lcg.in2p3.fr/wiki/images/Quattor_tcp_tuning.pdf Quattor TCP Tuning guide] aims to be a good documentation for helping you tuning your TCP Performance with Quattor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
The following parameters are important for TCP tuning:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
They can be modified:&lt;br /&gt;
* By directly passing the parameter to the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This method is useful for testing a parameter, as the modification will not persist after the next reboot.&lt;br /&gt;
* By adding the parameter to the &amp;lt;code&amp;gt;/etc/sysctl.conf&amp;lt;/code&amp;gt; file and loading it with the &#039;&#039;&#039;sysctl&#039;&#039;&#039; command. This way is interesting when you want to preserve the modification over a reboot.&lt;br /&gt;
&lt;br /&gt;
The following values are recommended:&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_rmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_wmem = 131072 1048576 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_default = 1048576&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.rmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.wmem_max = 2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_dsack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_sack = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.ipv4.tcp_timestamps = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;net.core.netdev_max_backlog = 10000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* http://fasterdata.es.net/&lt;br /&gt;
* http://monalisa.cern.ch/FDT/documentation_syssettings.html&lt;br /&gt;
* http://indico.cern.ch/contributionDisplay.py?sessionId=31&amp;amp;amp;contribId=55&amp;amp;amp;confId=61917&lt;br /&gt;
* http://www.psc.edu/networking/projects/tcptune/&lt;br /&gt;
* http://onlamp.com/pub/a/onlamp/2005/11/17/tcp_tuning.html&lt;br /&gt;
* http://en.wikipedia.org/wiki/TCP_tuning&lt;br /&gt;
&lt;br /&gt;
= Tuning disk I/O =&lt;br /&gt;
&lt;br /&gt;
== Kernel tuning ==&lt;br /&gt;
&lt;br /&gt;
Le fait d&#039;ajuster quelques paramètres du kernel permet d&#039;améliorer les performances au niveau des I/O disques. Le tuning doit être fait au niveau des block devices après chaque reboot du serveur. Ce tuning peut être très utile sur les serveurs de fichiers (DPM disk servers, xrootd servers, ...).&lt;br /&gt;
&lt;br /&gt;
Voici les valeurs recommandées pour un disque /dev/sdb par exemple :&lt;br /&gt;
&lt;br /&gt;
getra : 16384&lt;br /&gt;
queue_depth : 256&lt;br /&gt;
nr_requests : 512&lt;br /&gt;
scheduler : deadline (au lieu de cfq)&lt;br /&gt;
&lt;br /&gt;
Pour lire les valeurs actuelles de votre serveur pour le disque /dev/sdb, faire:&lt;br /&gt;
&lt;br /&gt;
blockdev --getra /dev/sdb&lt;br /&gt;
cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# blockdev --getra /dev/sdb&lt;br /&gt;
16384&lt;br /&gt;
# cat /sys/block/sdb/device/queue_depth&lt;br /&gt;
256&lt;br /&gt;
# cat /sys/block/sdb/queue/nr_requests&lt;br /&gt;
512&lt;br /&gt;
# cat /sys/block/sdb/queue/scheduler&lt;br /&gt;
noop anticipatory [deadline] cfq &lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour faire le tuning des I/O pour le disque sdb, faire:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
blockdev=sdb&lt;br /&gt;
blockdev --setra 16384 /dev/${blockdev}&lt;br /&gt;
echo 512 &amp;gt; /sys/block/${blockdev}/queue/nr_requests&lt;br /&gt;
echo deadline &amp;gt; /sys/block/${blockdev}/queue/scheduler&lt;br /&gt;
echo 256 &amp;gt; /sys/block/${blockdev}/device/queue_depth&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Le plus simple est de faire un script qui boucle sur tous les &#039;block devices&#039; à tuner et d&#039;ajuster les paramètres kernel pour chaque disque.&lt;br /&gt;
&lt;br /&gt;
N.B.: chaque site peut tester éventuelement d&#039;autres valeurs et benchmarker pour trouver les valeurs appropriées pour ses serveurs.&lt;br /&gt;
&lt;br /&gt;
Une remarque concernant queue_depth: selon le modèle de serveur, il y a une valeur max qui ne peut être dépassée. Si on essaye d&#039;affecter une valeur plus grande, c&#039;est la valeur max possible qui sera affectée à queue_depth.&lt;br /&gt;
&lt;br /&gt;
Par exemple sur un SUN X4500 si vous faites &amp;quot;echo 256 &amp;gt; /sys/block/sda/device/queue_depth&amp;quot;, vous aurez en fait 31 (la valeur max autorisée) dans queue_depth.&lt;br /&gt;
 &lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/main-io.html&lt;br /&gt;
* http://www.gluster.org/community/documentation/index.php/Linux_Kernel_Tuning&lt;br /&gt;
* http://insights.oetiker.ch/linux/raidoptimization/&lt;br /&gt;
* http://mylabfr.kaminoweb.com/increase-disk-queue-depth-on-linux/&lt;br /&gt;
* http://www.redhat.com/magazine/008jun05/features/schedulers/&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7718</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7718"/>
		<updated>2016-01-22T17:25:59Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Migration with preserving absolute file names */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it. Update the xrootd config file if necessary.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it. Update the xrootd config file if necessary.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required or just wait for one month. &lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7705</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7705"/>
		<updated>2015-12-11T19:08:45Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is a subdirectory of a xrootd data partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it. Update the xrootd config file if necessary.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it. Update the xrootd config file if necessary.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required or just wait for one month. &lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7704</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7704"/>
		<updated>2015-12-11T18:59:31Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it. Update the xrootd config file if necessary.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it. Update if necessary the xrootd config file.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required or just wait for one month. &lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7703</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7703"/>
		<updated>2015-12-11T17:25:07Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it. Update if necessary the xrootd config file.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it. Update if necessary the xrootd config file.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required or just wait for one month. &lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7702</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7702"/>
		<updated>2015-12-11T17:24:21Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is a subdirectory of a xrootd data partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace and update if necessary the xrootd config file. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it. Update if necessary the xrootd config file.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required or just wait for one month. &lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7701</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7701"/>
		<updated>2015-12-11T17:23:03Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace and update if necessary the xrootd config file. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required or just wait for one month. &lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7699</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7699"/>
		<updated>2015-12-01T09:11:05Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Why Monalisa continue to monitor decomissionned xrootd servers ? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required or just wait for one month. &lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7688</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7688"/>
		<updated>2015-11-23T10:27:26Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Should I set a xrootd server in read-only mode when decomissioning ? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
Yes.&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount xrootd partitions in read-only mode and start xroot service again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7687</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7687"/>
		<updated>2015-11-23T10:20:04Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* FAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Should I set a xrootd server in read-only mode when decomissioning ?==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== Is files duplication during migration from server A to B harmful ? ==&lt;br /&gt;
&lt;br /&gt;
No, it not harmful.&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Why Monalisa continue to monitor decomissionned xrootd servers ? ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7686</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7686"/>
		<updated>2015-11-21T20:07:51Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Less easy merge */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Migration_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7685</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7685"/>
		<updated>2015-11-21T20:06:59Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Copy when absolute file names can&amp;#039;t be preserved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Migration when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7684</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7684"/>
		<updated>2015-11-21T20:05:55Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Easy merge */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Migration_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7683</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7683"/>
		<updated>2015-11-21T20:03:24Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Migration of a xrootd server with rsync to another local xrootd server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Set_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7682</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7682"/>
		<updated>2015-11-21T20:01:30Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is a subdirectory of a xrootd data partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#Procedure_to_retrieve_and_transfer_back_lost_files]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7681</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7681"/>
		<updated>2015-11-21T19:58:10Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Procedure to retrieve and transfer back lost files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs and retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7680</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7680"/>
		<updated>2015-11-21T19:57:20Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Procedure to retrieve and transfer back lost files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd data and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs qnd retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7679</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7679"/>
		<updated>2015-11-21T19:56:29Z</updated>

		<summary type="html">&lt;p&gt;Diarra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd files and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs qnd retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_retrieve_and_transfer_back_lost_files|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7678</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7678"/>
		<updated>2015-11-21T19:54:48Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Procedure to collect the GUIDs of all the xrootd servers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to retrieve and transfer back lost files ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd files and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs qnd retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_collect_the_GUIDs_of_all_the_xrootd_serversfollowing procedure]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_collect_the_GUIDs_of_all_the_xrootd_servers|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7677</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7677"/>
		<updated>2015-11-21T19:53:54Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is a subdirectory of a xrootd data partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to collect the GUIDs of all the xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd files and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs qnd retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_collect_the_GUIDs_of_all_the_xrootd_serversfollowing procedure]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#Procedure_to_collect_the_GUIDs_of_all_the_xrootd_servers|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7676</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7676"/>
		<updated>2015-11-21T19:51:30Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When everything is lost or when the data partition containing the namespace is lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to collect the GUIDs of all the xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd files and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs qnd retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitions and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_collect_the_GUIDs_of_all_the_xrootd_serversfollowing procedure]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7675</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7675"/>
		<updated>2015-11-21T19:49:55Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When everything is lost or when the data partition containing the namespace is lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to collect the GUIDs of all the xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd files and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs qnd retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[#Procedure_to_collect_the_GUIDs_of_all_the_xrootd_serversfollowing procedure]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7674</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7674"/>
		<updated>2015-11-21T19:48:39Z</updated>

		<summary type="html">&lt;p&gt;Diarra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
== Procedure to collect the GUIDs of all the xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
If you lose xrootd files and are not able to retrieve the GUIDs of the lost files (for example when the namespace is lost and can&#039;t be fully restored) you must collect all the GUIDs of all the xrootd servers and provide them to ALICE experts who will be able to retrieve the files lost on your SE by making a &#039;diff&#039; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs you collected.&lt;br /&gt;
&lt;br /&gt;
The steps to collect all the GUIDs qnd retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files for this server. &lt;br /&gt;
&lt;br /&gt;
You must follow the [[following procedure]] to identify the lost files and let ALICE experts transfer these files back to you SE or to another SE.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7673</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7673"/>
		<updated>2015-11-21T19:12:26Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Setting a xrootd server in read-only mode when decomissioning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the [[#File_duplications_during_migration_from_server_A_to_B:_not_harmful|following point]] .&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7672</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7672"/>
		<updated>2015-11-21T19:03:20Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* Monalisa monitoring of decomissionned xrootd servers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the following point.&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor a decommissioned xrootd server and reports errors. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. &lt;br /&gt;
&lt;br /&gt;
To remove the decommissioned server from the monitoring, ALICE intervention is required.&lt;br /&gt;
&lt;br /&gt;
The status of all the xrootd servers for a SE (ex: ALICE::GRIF_IPNO::SE) can be visible at:&lt;br /&gt;
http://alimonitor.cern.ch/stats?page=xrootdse/table&amp;amp;cluster=ALICE::GRIF_IPNO::SE&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7671</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7671"/>
		<updated>2015-11-21T18:54:50Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* FAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
&lt;br /&gt;
This FAQ is a collection of Questions/Answers exchanged on the alice-lcg-task-force@cern.ch .&lt;br /&gt;
&lt;br /&gt;
== Setting a xrootd server in read-only mode when decomissioning ==&lt;br /&gt;
&lt;br /&gt;
You could first stop the xrootd service, remount ro and start it again. Any transfers in progress will fail but this is not a problem, there are fallbacks for both writing and reading. While doing this you can also add&lt;br /&gt;
    oss.readonly&lt;br /&gt;
to xrootd&#039;s configuration to make it aware of the situation.&lt;br /&gt;
&lt;br /&gt;
While migrating the data to server B it would be best if A would still be active to serve the existing files, even if this makes the data migration longer. It will be mitigated by the following point.&lt;br /&gt;
&lt;br /&gt;
== File duplications during migration from server A to B: not harmful ==&lt;br /&gt;
&lt;br /&gt;
The redirector broadcasts the request to the cluster, if both A and B reply they have a file the first one to answer will get the connection. There is no problem to have the same file on several disk servers, in fact you can do this to improve the performance of reading &amp;quot;hot files&amp;quot;. As such A should get less requests as B has more of its files.&lt;br /&gt;
&lt;br /&gt;
== Monalisa monitoring of decomissionned xrootd servers ==&lt;br /&gt;
&lt;br /&gt;
Monalisa will continue to monitor decommissioned xrootd servers. It will eventually give up trying to write to servers that are no longer active. Unless the record is manually removed, it has no idea if you decommissioned the server, it has hanged, powered down or has any connectivity issues but if the server doesn&#039;t report any monitoring data for one month it probably means it is a feature. I&#039;ve cleaned it now so you don&#039;t get the warning any more.&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7670</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7670"/>
		<updated>2015-11-21T18:38:13Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is a subdirectory of a xroot data partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xrootd data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7669</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7669"/>
		<updated>2015-11-21T18:34:55Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
The steps to follow to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7668</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7668"/>
		<updated>2015-11-21T18:27:39Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is a subdirectory of a xroot data partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 4 below.&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
N.B.: If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 6 below. But the consequence of this choice is that ALICE experts will have to transfer back all the files of the xrootd server instead of just the files of the damaged partition.&lt;br /&gt;
If you decide restore the namespace yourself from the existting files, you will greatly reduce the amount of files to transfer back because only the files in the damaged partition will need to be transfered back.&lt;br /&gt;
&lt;br /&gt;
The steps to restore the namespace and then identify the lost files are below.&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7667</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7667"/>
		<updated>2015-11-21T18:16:31Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps 1 to 4 below.&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7666</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7666"/>
		<updated>2015-11-21T18:05:21Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7665</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7665"/>
		<updated>2015-11-21T18:03:17Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is a subdirectory of a xroot data partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7664</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7664"/>
		<updated>2015-11-21T18:02:14Z</updated>

		<summary type="html">&lt;p&gt;Diarra: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the [[#When_everything_is_lost_or_when_the_data_partition_containing_the_namespace_is_lost|procedure at to restore the lost files]] .&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7663</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7663"/>
		<updated>2015-11-21T17:58:45Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When all the xrootd disk partitons and the namespace are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When everything is lost or when the data partition containing the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files. This is the situation where &amp;quot;everything is lost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
There is an other case where we can&#039;t collect the GUIDs of the lost files : when one lose a data partition containing also the namespace as a subdirectory. But in this case we still know the GUIDs of the files in the remaining partitions which can help to partially restore the namespace.&lt;br /&gt;
&lt;br /&gt;
In the above two cases the steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7662</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7662"/>
		<updated>2015-11-21T17:26:53Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When all the xrootd disk partitons and the namespace are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On all the remaining xrootd servers of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7661</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7661"/>
		<updated>2015-11-21T17:25:14Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition&lt;br /&gt;
do&lt;br /&gt;
  for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7660</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7660"/>
		<updated>2015-11-21T17:24:16Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition    for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7659</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7659"/>
		<updated>2015-11-21T17:24:02Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
for each xrootd data partition    for each xrootd data file&lt;br /&gt;
  do&lt;br /&gt;
      create in the namespace the symlink to the data file&lt;br /&gt;
  done&lt;br /&gt;
done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7658</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7658"/>
		<updated>2015-11-21T17:21:45Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* The lost namespace is in a separate disk partition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place (directory) to restore the namespace, you must create in this place one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7657</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7657"/>
		<updated>2015-11-21T17:19:40Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When all the xrootd disk partitons and the namespace are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer progress.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place to restore the namespace, you must create one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7656</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7656"/>
		<updated>2015-11-21T17:19:17Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When all the xrootd disk partitons and the namespace are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once the experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE (if it still has enough free space available) or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer evolution.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place to restore the namespace, you must create one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7655</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7655"/>
		<updated>2015-11-21T17:17:28Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When all the xrootd disk partitons and the namespace are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the (big) files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere on the web and provide the URL (http://, ftp://, ...) to the ALICE experts&lt;br /&gt;
&lt;br /&gt;
5) Once ALICE experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE if it has enough disk space available or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer evolution.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place to restore the namespace, you must create one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7654</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7654"/>
		<updated>2015-11-21T17:10:59Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When all the xrootd disk partitons and the namespace are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
The steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere and provide the URL to retrive them&lt;br /&gt;
&lt;br /&gt;
5) Once ALICE experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE if it has enough disk space available or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer evolution.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place to restore the namespace, you must create one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7653</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7653"/>
		<updated>2015-11-21T17:10:07Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When one or more xrootd disk partitions are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that the experts can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
Thes steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere and provide the URL to retrive them&lt;br /&gt;
&lt;br /&gt;
5) Once ALICE experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE if it has enough disk space available or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer evolution.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place to restore the namespace, you must create one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
	<entry>
		<id>https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7652</id>
		<title>ALICE native xrootd</title>
		<link rel="alternate" type="text/html" href="https://lcg.in2p3.fr/index.php?title=ALICE_native_xrootd&amp;diff=7652"/>
		<updated>2015-11-21T17:08:43Z</updated>

		<summary type="html">&lt;p&gt;Diarra: /* When one or more xrootd disk partitions are lost */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Decommissioning ALICE native xrootd servers and dealing with data loss&lt;br /&gt;
&lt;br /&gt;
= Aim of this documentation =&lt;br /&gt;
&lt;br /&gt;
The objective of this document is to detail the procedure to follow by system administrators when they want to remove a xrootd server (decommissioning) or when they lost a filesystem (mounted disk partition) on a xrootd server.&lt;br /&gt;
&lt;br /&gt;
This document is based on the mails exchanged on the alice-lcg-task-force@cern.ch list and on the real cases encountered at the GRIF-IPNO site. Costin Grigoras is the main author of the different recommendations and tips successfully applied at IPNO.&lt;br /&gt;
&lt;br /&gt;
= About the examples =&lt;br /&gt;
&lt;br /&gt;
The examples are taken from the IPNO sites where the redirector is ipngridxrd0.in2p3.fr and the xrootd servers are ipngridxrd1, ipngridxrd2, ...&lt;br /&gt;
On all the xrootd servers the xrootd data partitions mount points follow the same naming convention: the data partitions are mounted on /grid/xrddataX {X=1..8} and the namespace is in the /grid/xrddata1/namespace subdirectory .&lt;br /&gt;
&lt;br /&gt;
= A quick presentation of the xrootd files tree =&lt;br /&gt;
&lt;br /&gt;
On each xrootd server there are one or more disk partitions where the data files are stored. There is also a namespace which is a directory containing the names of the data files: theses names are the ones the redirector uses. The name (or file name) itself is a symlink to the real xrootd data file. The name space can be in a separate partition or in a subdirectory of a data partition.&lt;br /&gt;
&lt;br /&gt;
In the case of IPNO, the namespace is always a subdirectory of the first data partition. Here are some examples from one xrootd server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# df -h|grep xrddata&lt;br /&gt;
/dev/sdb1             9.1T  5.6T  3.6T  62% /grid/xrddata1&lt;br /&gt;
/dev/sdb2             9.1T  5.6T  3.6T  62% /grid/xrddata2&lt;br /&gt;
/dev/sdb3             9.1T  5.6T  3.6T  62% /grid/xrddata3&lt;br /&gt;
/dev/sdb4             9.1T  5.6T  3.6T  62% /grid/xrddata4&lt;br /&gt;
/dev/sdc1             9.1T  5.6T  3.6T  62% /grid/xrddata5&lt;br /&gt;
/dev/sdc2             9.1T  5.6T  3.6T  62% /grid/xrddata6&lt;br /&gt;
/dev/sdc3             9.1T  5.6T  3.6T  62% /grid/xrddata7&lt;br /&gt;
/dev/sdc4             9.1T  5.6T  3.6T  62% /grid/xrddata8&lt;br /&gt;
# &lt;br /&gt;
# ls -ld /grid/xrddata1/namespace&lt;br /&gt;
drwxr-xr-x 18 xrootd xrootd 4096 Mar 30  2015 /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The data file  %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the partion /grid/xrddata6 is recorded in the namespace as &lt;br /&gt;
/grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -lh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
lrwxrwxrwx 1 xrootd xrootd 85 Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f -&amp;gt;&lt;br /&gt;
 /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&lt;br /&gt;
# ls -lLh /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
-rw-rw-r-- 1 xrootd xrootd 3.6M Apr  7  2015 /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the file in this example, the URL will be root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f where ipngridxrd0 is the redirector here. For example to copy the file from a WN:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# xrdcp root://ipngridxrd0.in2p3.fr:1094//00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /tmp/xrd_test.dat&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.59&lt;br /&gt;
[3.594MB/3.594MB][100%][==================================================][3.594MB/s]  &lt;br /&gt;
[root@ipngrid90 ~]# ls -lh /tmp/xrd_test.dat&lt;br /&gt;
-rw-r--r-- 1 root root 3.6M Nov 18 10:54 /tmp/xrd_test.dat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some observations:&lt;br /&gt;
* the file name in the namespace contains the GUID of the xrootd data file (ex: b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the example above)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# basename /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* the xrootd data file name is built from the name in the namespace. In the example above, the xrootd data file name %grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f in the directory /grid/xrddata6/ is built from the name 00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f of the namespace.&lt;br /&gt;
* the xrootd data file name can be a random one as long as the symlink in the namespace continue to point to it. So one can do (to avoid in practice because there is no reason to do it) :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service xrdservices stop&lt;br /&gt;
# mv /grid/xrddata6/%grid%xrddata1%namespace%00%65278%b8f9f574-dd42-11e4-a4e6-63e8b3f6492f /grid/xrddata6/testfile.dat&lt;br /&gt;
# ln -fs /grid/xrddata6/testfile.dat /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f&lt;br /&gt;
# service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the xrootd data file is renamed as /grid/xrddata6/testfile.dat, xrootd will continue to see it as /grid/xrddata1/namespace/00/65278/b8f9f574-dd42-11e4-a4e6-63e8b3f6492f because we updated the symlink. This flexibility will allow the transfer of the data from one xrootd server to another even if the directory tree is not exactly the same on both servers.&lt;br /&gt;
&lt;br /&gt;
= Decommissioning a xrootd server =&lt;br /&gt;
&lt;br /&gt;
You may need the remove a xrootd server for many reasons (old hardware, frequent failures, ...). Before stopping the server and disconnecting it from the network, ALICE should be informed by sending an e-mail to alice-lcg-task-force@cern.ch. The experts from ALICE will tell you what to do to transfer the data elsewhere. There are many cases:&lt;br /&gt;
&lt;br /&gt;
# you have enough space on another xrootd server on your site to transfer the data to&lt;br /&gt;
#* in this case you must copy the data with rsync to this xrootd server&lt;br /&gt;
# you have enough space available on your SE but no xrootd server alone can receive all the data&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to your SE&lt;br /&gt;
# your SE doesn&#039;t have enough space to store the copies of the files&lt;br /&gt;
#* in this case, ALICE will ask you to send the list of the GUIDs and sizes of the files you need to transfer and will manage the transfer to the SE on another ALICE site&lt;br /&gt;
&lt;br /&gt;
The procedures in the different cases are detailed below.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
When you decide to decomission a xrootd server you must set it in read-only mode: you must stop xrootd services on the server being decomminssioned, remount the xrootd partitionss in read-only mode and restart xrootd services.&lt;br /&gt;
&lt;br /&gt;
For example if you have 8 xrootd partitions, you can do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
service xrdservices stop&lt;br /&gt;
for i in $(seq 1 8); do mount -o remount,ro /grid/xrddata$i; done&lt;br /&gt;
service xrdservices start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server with rsync to another local xrootd server ==&lt;br /&gt;
&lt;br /&gt;
Suppose that A is the xrootd server being decommissioned and B a xrootd server having enough disk space to receive data from A. In this case you can use rsync to transfer the data from A to B.&lt;br /&gt;
&lt;br /&gt;
I you have N filesystems (mounted partitions) to transfer from A to B, B should have at least N partitions with sufficient space available. Even though it is possible to split a partition from A to more than one partitions of B, this should be avoided. It is much more easier and safer to copy each partition of A entirely to only one partition of B.&lt;br /&gt;
&lt;br /&gt;
Before starting the copy, you must stop xrootd services on A, remount the xrootd data partitions in read-only mode and restart xrootd services ([[#Put_the_xrood_server_in_read-only_mode]]).&lt;br /&gt;
&lt;br /&gt;
After the data copy, the namespace on the server B must be updated to reflect its new content. The namespace on B can be updated for each copied partition or only after the last partition is copied.&lt;br /&gt;
&lt;br /&gt;
After the namespace on B is up-to-date, the server A can be stopped and disconnected from the network to avoid accidental reboot.&lt;br /&gt;
&lt;br /&gt;
=== About the namespaces merging ===&lt;br /&gt;
&lt;br /&gt;
After the xrootd data files are copied from server A  to server B, the namespace on B must be merged with the namespace of A.&lt;br /&gt;
There are many possible cases.&lt;br /&gt;
&lt;br /&gt;
# Identical source and destination partition names&lt;br /&gt;
#: If for each partition copied from A to B, the partition name is identical on A an B, then the only thing to to after the copy of the data files is to copy the namespace from A to B&lt;br /&gt;
# Some source and destination partition names are different&lt;br /&gt;
#: In this case, after the copy of each partition or after the last partition is copied you must update the namespace on B by a simple copy or by making symlinks.&lt;br /&gt;
#* when a data partition name is unchanged during the copy, just copy the concerned file names from the namespace of A to B&lt;br /&gt;
#* when a data partition name is changed during the copy, you must recreate in the namespace on B the symlinks and point to the new paths of the data files.&lt;br /&gt;
&lt;br /&gt;
N.B.: Each time an entry is inserted in the namespace of B (i.e the symlink to a xrootd data file is created), B will start to serve the file in parallel with A and this will have the effect to reduce the load on A.&lt;br /&gt;
&lt;br /&gt;
==== Easy merge ====&lt;br /&gt;
&lt;br /&gt;
If all the data copied from any partion of A land in a directory with the same name on B, the namespace merging can be done by just copying the files from the namespace of A to the namespace of B. This is what is done at [[#Copy_with_preserving_absolute_file_names]] .&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s supposed that 4 partitions A:/grid/xrddata{1,2,3,4} are copied respectively to B:/grid/xrddata{1,2,3,4}. If the namespaces are A:/grid/xrddata1/namespace and B:/grid/xrddata1/namespace, then the merge can be done by copying the files from A:/grid/xrddata1/namespace/ to &lt;br /&gt;
B:/grid/xrddata1/namespace/ .&lt;br /&gt;
&lt;br /&gt;
For example, during the copy, a file such A:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 will be copied unchanged to to B:/grid/xrddata1/namespace/04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 .&lt;br /&gt;
&lt;br /&gt;
==== Less easy merge ====&lt;br /&gt;
&lt;br /&gt;
There may be some cases where the source directory and the destination directory names differ. For example let&#039;s suppose you have to do the following files copy:&lt;br /&gt;
&lt;br /&gt;
* A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
In this case before starting the copy, you must collect the file names for each partition because you will need to recreate these names in the namespace of B as symlinks pointing to the new location of the copied files. You can save the list of files in a two columns file  : &lt;br /&gt;
* first colum = the names (symlinks) in A namespace&lt;br /&gt;
* second column = real xrootd data file names&lt;br /&gt;
&lt;br /&gt;
You will need this list to update the namespace on serrver B.&lt;br /&gt;
See [[#Copy_when_absolute_file_names_can.27t_be_preserved]] for the copy and merging procedure and for the script to create the files list.&lt;br /&gt;
&lt;br /&gt;
=== Migration with preserving absolute file names ===&lt;br /&gt;
&lt;br /&gt;
This is possible only if you have the same mount points naming convention on A an B. To preserve the xrootd data file name during the copy you must copy data from each partition of A to a partition with the same name on B.&lt;br /&gt;
&lt;br /&gt;
The steps to follow are detailed below.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
* Then :&lt;br /&gt;
&lt;br /&gt;
# First copy all the xrootd data files from A to B&lt;br /&gt;
# merge the two namespaces: copy the file names from the namespace of A to the namespace of B&lt;br /&gt;
&lt;br /&gt;
The following script (to be edited before running it) will do the copy and the namespace merging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat simple_xrootd_files_copy.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script will transfer all the xrootd files from the current &lt;br /&gt;
# server to DEST_SERVEUR&lt;br /&gt;
# Ensure all the partitions are mounted in read-only before running this script:&lt;br /&gt;
#   service xrdservices stop&lt;br /&gt;
#   for i in $(seq 1 8); do mount -o remount /grid/xrddata$i; done &lt;br /&gt;
#   service xrdservices start&lt;br /&gt;
#&lt;br /&gt;
# Here we suppose that the mount point naming conventions are the same&lt;br /&gt;
# on both servers and that the copy will preserve the path name of the files:&lt;br /&gt;
# the source and destination directories have the same name&lt;br /&gt;
# i.e copies are from src_server:/grid/xrddata$i to dest_server:/grid/xrddata$i&lt;br /&gt;
&lt;br /&gt;
# !!!! Start of the area where variables must be adjusted &lt;br /&gt;
DEST_SERVEUR=&amp;quot;ipngridxrdB.in2p3.fr&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Base name of the mount points respecting the same naming conventions on &lt;br /&gt;
# both servers&lt;br /&gt;
# Here I have partitions /grid/xrddata1, /grid/xrddata2, ... on each server&lt;br /&gt;
SRC_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
DEST_PARTITION_PREFIX=&amp;quot;/grid/xrddata&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#namespace: directory containing the namespace&lt;br /&gt;
SRC_NAME_SPACE=&amp;quot;${SRC_PARTITION_PREFIX}1/namespace/&amp;quot;&lt;br /&gt;
DEST_NAME_SPACE=${SRC_NAME_SPACE}&lt;br /&gt;
&lt;br /&gt;
# number of partitions to copy&lt;br /&gt;
# Exemple: &amp;quot;1 2&amp;quot; means copy the partions /grid/xrddata1 and /grid/xrddata2&lt;br /&gt;
SRC_PARTITION_NUM=&amp;quot;1 2 3 4 5 6&amp;quot;&lt;br /&gt;
# !!!! End of the area where variables must be adjusted &lt;br /&gt;
&lt;br /&gt;
# Excluded files &lt;br /&gt;
# You must not copy the namespace before the xrootd data files, so exclude the&lt;br /&gt;
# namespace now and copy it at the end&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
# Copy the xrootd data files&lt;br /&gt;
for n in $SRC_PARTITION_NUM&lt;br /&gt;
do&lt;br /&gt;
  p=&amp;quot;${SRC_PARTITION_PREFIX}$n/&amp;quot;&lt;br /&gt;
  echo -n &amp;quot;Starting the copy of partition $p : &amp;quot;; date&lt;br /&gt;
  rsync -a --exclude-from=${EXCLUDED_FILES} $p ${DEST_SERVEUR}:$p&lt;br /&gt;
  echo -n &amp;quot;End of copy of partition $p: &amp;quot;; date&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Copie of the namespace&lt;br /&gt;
  echo -n &amp;quot;Starting the copie of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
  rsync -a ${SRC_NAME_SPACE} ${DEST_SERVEUR}:${DEST_NAME_SPACE}&lt;br /&gt;
  echo -n &amp;quot;End of copy of the namespace ${SRC_NAME_SPACE} : &amp;quot;; date&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Cleaning&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Copy when absolute file names can&#039;t be preserved ===&lt;br /&gt;
&lt;br /&gt;
Suppose that we want to decommission server A having 3 data partitions /grid/xrddata{1,2,3}. We have a Server B with enough free disk space to hold the data from A in the partitions /grid/xrddata{1,7,8} respectively. We see that for two directories the source and destination names differ. &lt;br /&gt;
&lt;br /&gt;
The copy to be done are: &lt;br /&gt;
&lt;br /&gt;
* copy A:/grid/xrddata1 to B:/grid/xrddata1 &lt;br /&gt;
* copy A:/grid/xrddata2 to B:/grid/xrddata7&lt;br /&gt;
* copy A:/grid/xrddata3 to B:/grid/xrddata8&lt;br /&gt;
&lt;br /&gt;
==== Collect the information on the xrootd files ====&lt;br /&gt;
&lt;br /&gt;
We must first collect all the information about xrootd files on server A by running the script collect_xrootd_files_info.sh (see [[#Collecting_files_GUIDs_and_other_information]]).&lt;br /&gt;
&lt;br /&gt;
Once the copy of the data is done, one can process the file name2file_map to extract the list of files copied from each A partitions and use this list to update the symlinks in the namespace of B ([[#About_the_namespaces_merging]]).&lt;br /&gt;
&lt;br /&gt;
In our example we have to copy of 3 partitions. First we have to do the copy and after the merge.&lt;br /&gt;
&lt;br /&gt;
==== Copy the xrootd data files ====&lt;br /&gt;
&lt;br /&gt;
Allow root ssh connexion without a password from A to B if you don&#039;t want to give the B root password each time you will run rsync.&lt;br /&gt;
&lt;br /&gt;
# ssh-keygen -t rsa&lt;br /&gt;
# ssh-copy-id root@B&lt;br /&gt;
&lt;br /&gt;
On server A, do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat copy_xrootd_data_files.sh&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
EXCLUDED_FILES=&amp;quot;/tmp/excluded_xfr_$$&amp;quot;&lt;br /&gt;
/bin/rm -f ${EXCLUDED_FILES}&lt;br /&gt;
cat &amp;gt; ${EXCLUDED_FILES} &amp;lt;&amp;lt;EOF&lt;br /&gt;
*.lock&lt;br /&gt;
*.fail&lt;br /&gt;
DIR_LOCK&lt;br /&gt;
namespace&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata1/ B:/grid/xrddata1&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata2/ B:/grid/xrddata7&lt;br /&gt;
rsync -a  --exclude-from=${EXCLUDED_FILES} A:/grid/xrddata3/ B:/grid/xrddata8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The namespace merging  ====&lt;br /&gt;
&lt;br /&gt;
Now that the data files are copied we can merge the namespaces.&lt;br /&gt;
&lt;br /&gt;
Here is a possible scenario.&lt;br /&gt;
&lt;br /&gt;
1) On server A, prepare the list of files to process per partition&lt;br /&gt;
&lt;br /&gt;
* From the file name2file_map, build the list of files copied from each individual partition&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# for i 1 2 3; do grep &amp;quot;\/grid\/xrddata${i}&amp;quot; name2file_map &amp;gt; /tmp/xrddata${i}.list; done&lt;br /&gt;
# scp A:/tmp/xrddata{1,2,3}.list B:/tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Merging the namespace for /grid/xrddata1&lt;br /&gt;
&lt;br /&gt;
The source and destination partition names in rsync was the same. So we can simply copy the namespace from A to B for the concerned files only.&lt;br /&gt;
&lt;br /&gt;
* On server A:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /tmp/xrddata1.list | awk &#039;{print $1}&#039; &amp;gt;  /tmp/xrddata1.names&lt;br /&gt;
# cd /grid/xrdata1/namespace&lt;br /&gt;
# loop on all the file names in /tmp/xrddata1.names and copy them from  A:/grid/xrdata1/namespace B:/grid/xrdata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Merging the namespace for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
The xrootd data files have been moved from the directory /grid/xrddata2 to a directory /grid/xrddata7 and therefore the symlinks in the namespace of B need to created to reflect the new location of the files.&lt;br /&gt;
&lt;br /&gt;
* On server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sed -i &#039;s/\/grid\/xrddata2/\/grid\/xrddata7/g&#039; /tmp/xrddata2.list&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a script to implement this pseudo-code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /grid/xrdata1/namespace&lt;br /&gt;
# Each line of the file /tmp/xrddata2.list has two columns: column1 and column2&lt;br /&gt;
for each line from /tmp/xrddata2.list&lt;br /&gt;
do&lt;br /&gt;
   name=column1&lt;br /&gt;
   file=column2   &lt;br /&gt;
   continue if $file doesn&#039;t exist&lt;br /&gt;
   mkdir -p $(dirname $name)&lt;br /&gt;
   ln -s $file $name&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Merging the namespace for /grid/xrddata3&lt;br /&gt;
&lt;br /&gt;
Same procedure to follow as for /grid/xrddata2&lt;br /&gt;
&lt;br /&gt;
After this example, you have understood that one should avoid splitting data from one partition of A to more than one partition on B, because the transfer and the namespace merging will be much more complicated an this can lead to mistakes.&lt;br /&gt;
&lt;br /&gt;
== Migration of a xrootd server done by the ALICE experts  ==&lt;br /&gt;
&lt;br /&gt;
When you can&#039;t migrate the xrootd server with rsync to another local xrootd server, you can ask ALICE experts to do it by providing them with the GUIDs of the files to transfer to your SE or to another SE is you don&#039;t have enough space on your SE.&lt;br /&gt;
&lt;br /&gt;
=== Set the xrood server in read-only mode ===&lt;br /&gt;
&lt;br /&gt;
See [[#Set_the_xrood_server_in_read-only_mode]]&lt;br /&gt;
&lt;br /&gt;
=== Collecting files GUIDs and other information ===&lt;br /&gt;
&lt;br /&gt;
You need to collect the files GUIDs and provide them to the ALICE experts. With these information the transfer will be managed by ALICE experts through xrootd itself (from SE to SE) .&lt;br /&gt;
&lt;br /&gt;
The script collect_xrootd_files_info.sh will produce 4 files in the subdir /var/tmp/GUIDS_$(hostname)_PID.&lt;br /&gt;
&lt;br /&gt;
* file_names : contains the names (from the namespace) to be used in the xrootd URL when copying a xrootd data file with xrdcp for example&lt;br /&gt;
* guids_and_sizes : contains the GUIDs of the xrootd data files plus their sizes&lt;br /&gt;
* missing_files_names : contains the list of missing files (broken symlinks or missing data files)&lt;br /&gt;
* missing_files_guids : contains the GUIDs of the files in missing_files_names&lt;br /&gt;
* name2file_map : contains two columns:&lt;br /&gt;
** first column=file name in the namespace&lt;br /&gt;
** second colum=xrootd data file full path name&lt;br /&gt;
&lt;br /&gt;
Here is the collect_xrootd_files_info.sh script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat collect_xrootd_files_info.sh &lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Collect the GUIDs + file sizes on an xrootd disk server. Also collect the &lt;br /&gt;
# GUIDs of missing files.&lt;br /&gt;
# NB: !!! Before launching this script, make sure to first mount &lt;br /&gt;
# xrootd data partitions in read-only monde&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; != &amp;quot;1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Usage: $0 namespace_base_dir&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  echo &amp;quot;Example: $0 /grid/xrddata1/namespace&amp;quot;&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  exit 0&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
NAMESPACE=$1&lt;br /&gt;
&lt;br /&gt;
[ ! -d &amp;quot;${NAMESPACE}&amp;quot; ] &amp;amp;&amp;amp; echo &amp;quot;${NAMESPACE}: is not a directory&amp;quot; &amp;amp;&amp;amp; exit 1&lt;br /&gt;
&lt;br /&gt;
OUTDIR=/var/tmp/GUIDS_$(hostname)_$$&lt;br /&gt;
mkdir -p ${OUTDIR}&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
echo &amp;quot;The result of this script will be stored in files in ${OUTDIR} ...&amp;quot;&lt;br /&gt;
echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Example of entry : ./04/11522/4107d468-a7f6-11df-b283-001e0bd3f44c&lt;br /&gt;
FILE_NAMES=&amp;quot;${OUTDIR}/file_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Example of entry: 05151ae6-76d7-11e5-aad5-8b87ecfb2d4e 19676060&lt;br /&gt;
GUIDS_AND_SIZES=&amp;quot;${OUTDIR}/guids_and_sizes&amp;quot; # details (ls -l) des fichiers&lt;br /&gt;
&lt;br /&gt;
# Broken links: entry (symlinks) in the namespace without a data file&lt;br /&gt;
MISSING_FILES_NAMES=&amp;quot;${OUTDIR}/missing_files_names&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# GUIDs of missing files&lt;br /&gt;
MISSING_FILES_GUIDS=&amp;quot;${OUTDIR}/missing_files_guids&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Name to file mapping: file with two columns: &lt;br /&gt;
# name in the namespace | xrootd file full path name&lt;br /&gt;
NAME2FILE_MAPPING=&amp;quot;${OUTDIR}/name2file_map&amp;quot;&lt;br /&gt;
&lt;br /&gt;
cd ${NAMESPACE}&lt;br /&gt;
&lt;br /&gt;
# File names from the namespace including missings files (broken links)&lt;br /&gt;
find . -type l -print &amp;gt; ${FILE_NAMES}&lt;br /&gt;
&lt;br /&gt;
# Details on data files : ls -l&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -lL &amp;gt; ${GUIDS_AND_SIZES} 2&amp;gt; ${MISSING_FILES_NAMES}&lt;br /&gt;
&lt;br /&gt;
# keep only GUIDs and file sizes&lt;br /&gt;
sed -i &#039;s/\// /g&#039; ${GUIDS_AND_SIZES}&lt;br /&gt;
cat ${GUIDS_AND_SIZES} | awk &#039;{print $NF &amp;quot; &amp;quot; $5}&#039; &amp;gt; ${GUIDS_AND_SIZES}_tmp&lt;br /&gt;
/bin/mv ${GUIDS_AND_SIZES}_tmp ${GUIDS_AND_SIZES}&lt;br /&gt;
&lt;br /&gt;
# Save missing files GUIDs&lt;br /&gt;
cp  ${MISSING_FILES_NAMES} ${MISSING_FILES_GUIDS}&lt;br /&gt;
sed -i -e &#039;s/\// /g&#039; -e &#039;s/\://g&#039; ${MISSING_FILES_GUIDS}&lt;br /&gt;
cat ${MISSING_FILES_GUIDS} | awk &#039;{print $5}&#039; &amp;gt; ${MISSING_FILES_GUIDS}_tmp&lt;br /&gt;
/bin/mv ${MISSING_FILES_GUIDS}_tmp ${MISSING_FILES_GUIDS}&lt;br /&gt;
&lt;br /&gt;
# Create name to file mappinag&lt;br /&gt;
cat ${FILE_NAMES} | xargs ls -l | awk &#039;{print $9 &amp;quot; &amp;quot; $NF}&#039; &amp;gt; ${NAME2FILE_MAPPING}&lt;br /&gt;
# Exclude the missing files : broken links &lt;br /&gt;
# Commented in bellow because cpu and memory hungry. The missing files can be &lt;br /&gt;
# avoided an other way when using the file ${NAME2FILE_MAPPING} to merge the namespace&lt;br /&gt;
#grep -v -f ${MISSING_FILES_GUIDS} ${NAME2FILE_MAPPING} &amp;gt; ${NAME2FILE_MAPPING}_tmp&lt;br /&gt;
#/bin/mv ${NAME2FILE_MAPPING}_tmp ${NAME2FILE_MAPPING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# date ; sh collect_xrootd_files_info.sh /grid/xrddata1/namespace; date&lt;br /&gt;
Thu Nov 19 17:08:15 CET 2015&lt;br /&gt;
&lt;br /&gt;
The result of this script will be stored in files in /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663 ...&lt;br /&gt;
&lt;br /&gt;
Thu Nov 19 17:18:10 CET 2015&lt;br /&gt;
&lt;br /&gt;
# cd /var/tmp/GUIDS_ipngridxrd16.in2p3.fr_40663&lt;br /&gt;
# ls -lh *&lt;br /&gt;
-rw-r--r-- 1 root root  49M Nov 19 17:08 file_names&lt;br /&gt;
-rw-r--r-- 1 root root  46M Nov 19 17:17 guids_and_sizes&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:17 missing_files_guids&lt;br /&gt;
-rw-r--r-- 1 root root    0 Nov 19 17:08 missing_files_names&lt;br /&gt;
-rw-r--r-- 1 root root 135M Nov 19 17:18 name2file_map&lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
# wc -l *&lt;br /&gt;
  1052454 file_names&lt;br /&gt;
  1052454 guids_and_sizes&lt;br /&gt;
        0 missing_files_guids&lt;br /&gt;
        0 missing_files_names&lt;br /&gt;
  1052454 name2file_map&lt;br /&gt;
&lt;br /&gt;
# head -2 file_names&lt;br /&gt;
./04/45205/7cb82112-3c56-11e5-9516-23d68bd9df8f&lt;br /&gt;
./04/45205/816a4938-2e30-11e2-9cd8-db9bc21ad468&lt;br /&gt;
&lt;br /&gt;
# head -2 guids_and_sizes&lt;br /&gt;
0cc502f4-1c43-11e5-b7b2-5f940fb22164 18961963&lt;br /&gt;
2444240a-de72-11e4-9879-079c5762f860 936798&lt;br /&gt;
&lt;br /&gt;
# head -2 name2file_map&lt;br /&gt;
./04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
./04/00196/2444240a-de72-11e4-9879-079c5762f860 /grid/xrddata3/%grid%xrddata1%namespace%04%00196%2444240a-de72-11e4-9879-079c5762f860&lt;br /&gt;
# &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= What to do in case of data loss ? =&lt;br /&gt;
&lt;br /&gt;
Due to a hardware failure, one can lose a partition and so all the xrootd files on this partition. In case of a such data loss, one must collect the GUIDs (see [[#Collecting_files_GUIDs_and_other_information|here]]) of the lost files and inform the ALICE experts by sending an e-mail to alice-lcg-task-force@cern.ch. The expert will use the GUIDs collected to find copies of these files from other ALICE SE. If the site still have enough disk space on it&#039;s SE, ALICE will transfer back the files to the site SE.&lt;br /&gt;
If there is no more free space on the site SE, ALICE will transfer the files to a SE of another ALICE site. ALICE will provide a link on Monalisa to follow the transfer progress (example: http://alimonitor.cern.ch/transfers/index.jsp?id=8364).&lt;br /&gt;
&lt;br /&gt;
In our example we will suppose that we have a xrootd server with 3 partitions /grid/xrddata{1,2,3} and that the namespace is under /grid/xrddata1/namespace .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When one or more xrootd disk partitions are lost ==&lt;br /&gt;
&lt;br /&gt;
Here we suppose that the namespace /grid/xrddata1/namespace is not damaged and that we lost only the partition /grid/xrddata3. &lt;br /&gt;
From the namespace, we can easily identify the missing files and send their GUIDs to ALICE so that ALICE can transfer back the lost files.&lt;br /&gt;
&lt;br /&gt;
Following is what to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then send the file &amp;quot;missing_files_guids&amp;quot; to the ALICE experts who will do the file transfer.&lt;br /&gt;
&lt;br /&gt;
== When all the xrootd disk partitons and the namespace are lost ==&lt;br /&gt;
&lt;br /&gt;
If you lose all the xrootd disk partitions plus the namespace on a xrootd server, you can&#039;t anymore collect the GUIDs of the lost files.&lt;br /&gt;
Thes steps to retrieve the lost files GUIDs are :&lt;br /&gt;
&lt;br /&gt;
1) On each xrootd server of the SE, run :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sh collect_xrootd_files_info.sh /grid/xrddata1/namespace&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) Concatenate all the guids_and_sizes files to produce one file (guids_and_sizes.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
3) Optionally concatenate all the missing_files_guids files to produce one file (missing_files_guids.all.gz for example)&lt;br /&gt;
&lt;br /&gt;
4) Put the files guids_and_sizes.all.gz and missing_files_guids.all.gz (optional) somewhere and provide the URL to retrive them&lt;br /&gt;
&lt;br /&gt;
5) Once ALICE experts will have the guids_and_sizes.all.gz file, they will retrieve the lost files by making a &amp;quot;diff&amp;quot; between all the GUIDs they have in the ALICE catalog for your SE and the GUIDs in guids_and_sizes.all.gz&lt;br /&gt;
&lt;br /&gt;
6) ALICE will starts the transfer of the lost files to your SE if it has enough disk space available or to an other SE. ALICE will give you a link on Monalisa to &amp;quot;monitor&amp;quot; the transfer evolution.&lt;br /&gt;
&lt;br /&gt;
== When only the namespace is lost ==&lt;br /&gt;
&lt;br /&gt;
There are two possible situations:&lt;br /&gt;
&lt;br /&gt;
* the namespace is in a separate disk partition (the partition contains only the namespace and no xrootd data files)&lt;br /&gt;
* the namespace is a subdirectory of a xroot data partition&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is in a separate disk partition ===&lt;br /&gt;
&lt;br /&gt;
If you still have all the data files, you can rebuild the namespace by processing all the xrootd data files names. First you will have to repair and remount the namespace partition or recreate the namespace as a subdirectory in one of the data partition with enough space is available. &lt;br /&gt;
&lt;br /&gt;
Once you have a place to restore the namespace, you must create one symlink for each xrootd data file available.&lt;br /&gt;
&lt;br /&gt;
For example, for the following xrootd data file /grid/xrddata3/%grid%xrddata1%namespace%04%00196%0cc502f4-1c43-11e5-b7b2-5f940fb22164, the entry to create in the namespace will be 04/00196/0cc502f4-1c43-11e5-b7b2-5f940fb22164&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to restore the namespace yourself because you think it is to complex to do, you can simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_all_the_xrootd_disk_partitons_and_the_namespace_are_lost]] and ignore the steps bellow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps to follow if you wan to restore the namespace yourself will be:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create a place to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
=== The lost namespace is a subdirectory of a xroot data partition ===&lt;br /&gt;
&lt;br /&gt;
This should not arrive unless some one makes an &#039;rm -rf&#039; in the namespace. So we must consider here that logically if the namespace is lost, this means that the whole partition is damaged. So in addition to the namespace, all the xrood data files in the partition are lost too.&lt;br /&gt;
&lt;br /&gt;
Following is a solution to restore the namespace and the lost files. You must first partially restore the namespace from the xrootd files still existing and ask ALICE to transfer back the lost files. &lt;br /&gt;
&lt;br /&gt;
So the steps are:&lt;br /&gt;
&lt;br /&gt;
1) service xrootdservices stop&lt;br /&gt;
&lt;br /&gt;
2) Create the directory to restore the namespace. For example repair/recreate the namespace partition and mount it.&lt;br /&gt;
&lt;br /&gt;
3) Populate the namespace for files still existing :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  for each xrootd data partition&lt;br /&gt;
     for each xrootd data file&lt;br /&gt;
     do&lt;br /&gt;
        create in the namespace the symlink to the data file&lt;br /&gt;
     done&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5) Restart xrootd&lt;br /&gt;
&lt;br /&gt;
6) Then follow the procedure at to restore the lost files at [[]]&lt;br /&gt;
&lt;br /&gt;
If you found the procedure above to complex, simply consider that you lost everything on the xrootd server and follow the procedure at [[#When_one_or_more_xrootd_disk_partitions_are_lost]]&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;/div&gt;</summary>
		<author><name>Diarra</name></author>
	</entry>
</feed>