You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Difference between revisions of "Help:Adding Disk Space"

From Wikitech
Jump to navigation Jump to search
imported>Jhedden
m (change lvm class from profile to role)
imported>SRodlund
(SRodlund moved page Help:Adding Disk Space to Help:Adding Disk Space to Cloud VPS instances: Adding more info to the title)
 
Line 1: Line 1:
{{DocumentationPage}}
+
#REDIRECT [[Help:Adding Disk Space to Cloud VPS instances]]
Cloud VPS instances have a maximum storage quota based on the size of the instance. By default only 20G of the allowed quota is allocated to the instance as the <code>/</code> volume.
 
 
 
The additional space is allocated to /srv. '''If you already have content in /srv, it will be hidden by the new mount'''. Back up your content before proceeding or see recovery instructions below.
 
 
 
== Adding space as a second volume ==
 
The additional space can be added to the instance as a separate logical volume. The easiest way to do this is by enabling the <code>role::labs::lvm::srv</code> Puppet role.  If you have Horizon puppet set to 'yaml mode' (the default):
 
 
 
# go to https://horizon.wikimedia.org/project/ ;
 
# set "''<code>your project</code>''" in the project filter;
 
# find the instance you want to change the in the table below that;
 
# click on the <code>Puppet Configuration</code> tab to get to the Puppet management screen for that instance;
 
# Add a new line with "role::labs::lvm::srv" to the "Puppet Classes" field
 
# wait for the Puppet job to run, OR connect to the instance and run <code>sudo puppet agent --test --verbose</code>.
 
 
 
 
 
If you have Horizon puppet set to 'guided mode':
 
 
 
# go to https://horizon.wikimedia.org/project/ ;
 
# set "''<code>your project</code>''" in the project filter;
 
# find the instance you want to change the in the table below that;
 
# click on the <code>Puppet Configuration</code> tab to get to the Puppet management screen for that instance;
 
# in the row for <code>role::labs::lvm::srv</code>, click on the <code>Apply Class</code> button;
 
# in the pop-up, click on the <code>Apply</code>;
 
# wait for the Puppet job to run, OR connect to the instance and run <code>sudo puppet agent --test --verbose</code>.
 
 
 
After the Puppet run completes you should see a new volume mounted at <code>/srv</code>. The size of this volume will depend on the amount of remaining quota for your instance.
 
 
 
Mind the <code>/srv</code>. directory will be owned by <code>root</code>., and this will be enforced by puppet. <code>/srv</code>. is a [[:en:Filesystem_Hierarchy_Standard|directory for a collection of local content]]. Best practice is to create subdirectories for each individual service and give permissions to project members appropriately.
 
 
 
=== Moving old /srv data to new volume ===
 
If you only realized that you need more space after you have put things in the /srv directory of the root partition, follow these basic steps to move that data to the new volume:
 
# Add the new volume as shown above
 
# Run <code>mount</code> and make sure the volume is mounted. If it is not force another puppet run.
 
# Run <code>sudo -s</code> to get a root shell. This will make the next steps easier.
 
# <code>puppet agent --disable 'Moving data from /srv to new volume'</code>
 
# <code>umount /srv</code>
 
# <code>mount /dev/mapper/vd-second--local--disk /mnt</code>
 
# Copy data from /srv to /mnt with <code>cd /srv; tar cf - . | (cd /mnt; tar xpvf -)</code>
 
# Verify that /mnt now has the expected data.
 
# Remove old data from /srv with <code>cd /srv; rm -rf *</code>
 
# <code>cd; umount /mnt</code>
 
# <code>mount /dev/mapper/vd-second--local--disk /srv</code>
 
# Verify that mount worked with <code>mount</code> and by examining /srv
 
# <code>puppet agent --enable</code>
 
# <code>puppet agent --test --verbose</code> to make sure things stay as expected
 
 
 
== Resize root partition ==
 
See [[Help:Resize root partition]] for an explanation of how to attempt to resize the <code>/</code> volume for an existing instance.
 
 
 
[[Category:Cloud VPS]]
 

Latest revision as of 19:11, 14 February 2020