Transfer file storage to another project
You can transfer file storage data to another project. To do this, you need to create a file storage in the target project and transfer the data from the source storage to the target one.
-
Add a port for the cloud server to the subnet of the target project.
-
Connect the network and subnet of the source and target projects to the global router.
1. Create a file storage in the target project
Control panel
OpenStack CLI
Terraform
-
In the control panel, in the top menu, click Products and select File Storage.
-
Click Create storage.
-
Enter a name for the storage or keep the automatically generated one.
-
Select the location where the storage will be created.
If you need to increase the disk space of a cloud server or a Managed Kubernetes cluster using file storage, select the location where the server or cluster is located. To increase the disk space of dedicated servers, file storage can be created in any location.
If you plan to use the storage for backups, we recommend choosing a location different from your primary infrastructure location to increase fault tolerance.
-
Fill in the sections:
-
Check the cost of the file storage.
-
Click Create.
Subnet
-
Select a private subnet where the storage will be located. The subnet type depends on what you need to connect the storage to:
- cloud private subnet — storage will be available to cloud servers and Managed Kubernetes clusters only in the pool you selected when creating the storage. To connect the storage, you will only need to mount it;
- global router subnet — storage will be available to dedicated servers, as well as cloud servers and Managed Kubernetes clusters located in other pools. To connect the storage, you need to configure network connectivity between the server or cluster and the storage via a global router. See network connectivity configuration examples in the instructions of the Connect file storage section.
Once the storage is created, the subnet cannot be changed.
-
Enter the private IP address for the storage or leave the first available address from the subnet, which is assigned by default. Once the storage is created, the IP address cannot be changed.
Settings
-
Select the file storage type:
- HDD Basic,
- SSD Universal,
- SSD Fast.
Once the storage is created, the storage type cannot be changed.
-
Specify the storage size: from 50 GB to 50 TB. After creation, you can increase the file storage, but cannot decrease it.
-
Select a protocol:
- NFSv4 — for connecting storage to servers running Linux or other Unix-based OS;
- CIFS SMBv3 — for connecting storage to servers running Windows OS.
Once the storage is created, the protocol cannot be changed.
Access rules
NFSv4
CIFS SMBv3
-
Configure access rules for the file storage:
- accessible to everyone — the storage will be available for any IP address in the private subnet where it is created;
- access restricted — the storage will be available only for specific IP addresses or private subnets. If you create the file storage without rules, access will be restricted for all IP addresses.
-
If you selected the Restricted access option, click Add rule.
-
Enter the IP address or CIDR of the private subnet and select the access level.
After creating the storage, you can configure new access rules.
2. Create a cloud server in the target project
Use the Create a cloud server instructions.
Select the private subnet of the file storage that you created in step 1.
3. Create a global router
- In the control panel, in the top menu, click Products and select Global Router.
- Click Create router. Each account has a limit of five global routers.
- Enter the router name.
- Click Create.
- If the router was created with the status
ERRORor is stuck in one of the statuses, create a ticket.
4. Add a port for the cloud server to the target project subnet
Use the Add port to subnet instructions.
Specify:
- the file storage subnet of the source project;
- IP address of the cloud server that you created in step 2.
5. Connect the source and target project networks and subnets to the router
You need to connect the networks and subnets of the projects and cloud platform pools containing the source file storage and the target file storage with the cloud server to the global router.
-
Make sure that the network has not yet been added to any of the account's global routers. In the control panel, in the top menu, click Products → Cloud Servers → Network → Private networks tab → make sure that the network card does not have the tag Global router.
-
Verify that the subnet meets the conditions:
- belongs to the private address range according to RFC 1918:
10.0.0.0/8,172.16.0.0/12, or192.168.0.0/16; - has a size of at least
/29, since three addresses will be occupied by Selectel network equipment; - does not overlap with other subnets added to this router: the IP addresses of each subnet on the router must not overlap with the IP addresses of other subnets on it.
- belongs to the private address range according to RFC 1918:
-
In the control panel, in the top menu, click Products and select Cloud Servers.
-
Go to the Network section → Private networks tab.
-
From the menu of the network, select Connect to global router.
-
Select a global router.
-
For the subnet of the source project, enter an IP address that will be assigned to the router, or leave the first available address from the subnet, which is assigned by default. Do not assign this address to your devices to avoid disrupting network operation. The last two available addresses in the subnet will be reserved as service addresses.
-
Click Connect. Do not close the window until a message appears stating that the network is connected. After this, in the control panel:
-
Repeat steps 5-8 for the target project subnet.
6. Add a static route to the source project subnet
Add a static route from the target project subnet to the source project subnet. Use the Configure static routes in a subnet instructions.
Specify:
- destination subnet — subnet of the target project in which you created the file storage in step 1;
- gateway (next-hop) — port of the global router that you created in step 3.
7. Add a static route to the target project subnet
Add a static route from the source project subnet to the target project subnet. Use the Configure static routes in a subnet instructions.
Specify:
- destination subnet — subnet of the source project where the source storage is located. You can view it in the control panel: in the top menu, click Products → File Storage → in the file storage line, click the subnet name → Subnets tab → subnet card;
- gateway (next-hop) — port of the global router that you created in step 3.
8. Mount file storages to the cloud server and transfer data
During data transfer, the resources of the file storage will be fully utilized. We recommend suspending work with the storage during the transfer.
NFSv4
CIFS SMBv3
Linux
Windows
-
Open the CLI.
-
Install the package for working with the NFS protocol:
sudo apt install nfs-common -
Create folders for mounting storages:
sudo mkdir -p /mnt/nfs_sourcesudo mkdir -p /mnt/nfs_target -
Mount the file storages:
sudo mount -vt nfs "<filestorage_source_ip_address>:/shares/share-<mountpoint_uuid>" /mnt/nfs_sourcesudo mount -vt nfs "<filestorage_target_ip_address>:/shares/share-<mountpoint_uuid>" /mnt/nfs_targetSpecify:
<filestorage_source_ip_address>— IP address of the source file storage. You can view it in the control panel: in the top menu, click Products → File Storage → storage page → Settings tab → IP field;<filestorage_target_ip_address>— IP address of the target file storage. You can view it in the control panel: in the top menu, click Products → File Storage → storage page → Settings tab → IP field;<mountpoint_uuid>— mount point ID. You can view it in the control panel: in the top menu, click Products → File Storage → storage page → Connection block → GNU/Linux tab.
-
Transfer data between storages:
rsync -avzhHl --progress /mnt/nfs_source/ /mnt/nfs_target/