How to migrate data directory of Bamboo and Nexus combination !

Most of the devops engineer face the problem of disk full, no matter how much they have thought about projected data space required at the project planning stage, sooner or later  data migration is the reality. Today will be talk about the steps involved in the migrating the Bamboo artifacts and nexus data repo migration to a bigger disk attached to ec2 instance.

Attaching new volume to EC2 instance

Step 1: EC2 console –> Volumes and create a new volume of 500Gb

Step 2: Select the created volume, right click and select the “attach volume” option.

Step 3: Select the instance from the instance text box as shown below.
attach ebs volume

Step 4: Now, login to your ec2 instance and list the available disks using the following command.

Step 5: Format the volume to ext4 filesystem using the following command.
sudo mkfs -t ext4 /dev/xvdf

Step 7: Create a directory of your choice to mount our new ext4 volume. I am using the name “bamboo-data”
sudo mkdir /opt/atlassian/data

Step 8: Mount the volume to “bamboo-data” directory using the following command.
sudo mount /dev/xvdf /opt/atlassian/data

Step 9: cd into bamboo-data directory and check the disk space for confirming the volume mount.
cd /opt/atlassian/data
df -h .

Step 10: EBS Automount On Reboot
Make an entry in the /etc/fstab file.
Back up the /etc/fstab file.
sudo cp /etc/fstab /etc/fstab.bak
Open /etc/fstab file and make an entry in the following format.
/dev/xvdf /opt/atlassian/data ext4 defaults,nofail 0 0
sudo mount -a


Nexus Data directory migration 

Follow these instructions to Change nexus nexus-3.0.2 blob path


Step 11 check the current data directory 
ps -ef | grep NexusMain | grep

Step 12
Shut down your repository manager from the terminal.
service nexus stop

Step 13 
Back up your data directory
manually move (recommended) or symlink the data folder to expose it to where pre-3.1 stored it
rsync -avzh /app/nexus/data /opt/atlassian/data/nexus-data

Step 14
create a symbolic link on the filesystem linking it back to the original location.
ln -s /opt/atlassian/data/nexus-data /app/nexus/data

Start up the repository manager
service nexus start

Bamboo Data directory migration 

Step 11 Stop bamboo server


Start Bamboo with the property -Dbamboo.paths.set.allowed=true

Step 12 
rsync -avzh /opt/atlassian/bamboo/new-bamboo-home/artifacts /opt/atlassian/data/bamboo-data/

Step 13 
change /opt/atlassian/bamboo/new-bamboo-home/bamboo.cfg.xml

<property name="">${bambooHome}/artifacts</property>
<property name="">/opt/atlassian/data/bamboo-data/artifacts</property>

just to be safe create a symbolik link tool
ln -s /opt/atlassian/data/bamboo-data/artifacts /opt/atlassian/bamboo/artifacts

Restart Bamboo

Rollback plan

just rollback both directories and restart

Take a snapshot of the ec2 instance before executing any command


This entry was posted in DevOps. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s