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 target project subnet.
-
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, from 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 a location where the storage will be created.
If you need to increase disk space with file storage, select the location where your cloud server or Managed Kubernetes cluster is located.
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 — the storage will be available for 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 — the storage will be available for dedicated servers, as well as cloud servers and Managed Kubernetes clusters that are in other pools. To connect the storage, you need to configure network connectivity between the server or cluster and the storage via the global router. See examples of configuring network connectivity in the instructions in 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 you 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 Access restricted, 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
Follow the instructions in Create a cloud server.
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. A limit of five global routers is set for each account.
- 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
Follow the instructions in Add a port to a subnet.
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.
-
Ensure that the network is not already added to any of the global routers in your account. In the control panel, in the top menu click Products → Cloud Servers → Network → Private networks tab → make sure the network card does not have a Global Router tag.
-
Verify that the subnet meets the conditions:
- belongs to the private address range per RFC 1918:
10.0.0.0/8,172.16.0.0/12or192.168.0.0/16; - is at least
/29, as 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 per RFC 1918:
-
In the control panel, from the top menu, click Products and select Cloud Servers.
-
Go to the Network section → Private networks tab.
-
In the network menu, select Connect to Global Router.
-
Select a global router.
-
For the source project subnet, enter the IP address to be assigned to the router, or leave it as the first available address from the subnet, which is assigned by default. Do not assign this address to your devices so as not to disrupt network operation. The last two available subnet addresses will be reserved as service addresses.
-
Click Connect. Do not close the window until a message appears confirming that the network is connected. After that, 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. Follow the instructions in Configure static routes in a subnet.
Specify:
- destination subnet — the target project subnet in which you created the file storage in step 1;
- gateway (next-hop) — the global router port 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. Follow the instructions in Configure static routes in a subnet.
Specify:
- destination subnet — the source project subnet where the source storage is located. You can view this in the control panel: from the top menu, click Products → File Storage → click the subnet name in the file storage row → Subnets tab → subnet card; ;
- gateway (next-hop) — the global router port that you created in step 3.
8. Mount file storages to the cloud server and transfer data
During data transfer, file storage resources will be fully utilized. We recommend pausing work with the storages 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: from the top menu, click Products → File Storage → storage page → Settings tab → IP;<filestorage_target_ip_address>— IP address of the target file storage. You can view it in the control panel: from the top menu, click Products → File Storage → storage page → Settings tab → IP;<mountpoint_uuid>— mount point ID. You can view it in the control panel: from the top menu, click Products → File Storage → storage page → Connection block → GNU/Linux.
-
Transfer data between storages:
rsync -avzhHl --progress /mnt/nfs_source/ /mnt/nfs_target/