Move file storage to another project
File storage data can be transferred to another project. To do this, you need to create a file storage in the target project and transfer data from the source storage to the target one.
-
Add the 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 file storage in the target project
Control panel
OpenStack CLI
Terraform
-
In the Control Panel, on the top menu, click Products and select File Storage.
-
Click Create Storage.
-
Enter a name for the repository or leave the name that is automatically created.
-
Select the region and pool segment where the storage will be created.
If you need to increase disk space with file storage, select a pool segment from the pool that hosts the cloud server or Managed Kubernetes cluster.
If you plan to use storage to store backups, we recommend selecting a pool segment from a different availability zone or region to improve fault tolerance.
-
Fill in the blocks:
-
Check out the price of file storage.
-
Click Create.
Subnetwork
-
Select the private subnet where the storage will be located. The type of subnet depends on what you want to connect the storage to:
- cloud private subnet — the storage will be available to Managed Kubernetes cloud servers and clusters only in the pool you selected when creating the storage. You will only need to mount the storage to connect it;
- global router subnet — the storage will be available for dedicated servers, as well as cloud servers and Managed Kubernetes clusters that are located in other pools. To connect the storage, you need to configure network connectivity between the server or cluster and the storage through the global router. See the Connect File Storage section for examples of how to configure network connectivity.
Once the repository is created, the subnet cannot be changed.
-
Enter a private IP address for the vault or leave the first available address from the subnet assigned by default. Once the storage is created, the IP address cannot be changed.
Settings
-
Select the type of file storage:
- HDD Basic,
- SSD Universal,
- SSD Fast.
Once created, the storage type cannot be changed.
-
Specify the storage size: from 50 GB to 50 TB. Once created, you can increase the file storage, but you cannot decrease it.
-
Select a protocol:
- NFSv4 — for connecting storage to servers with Linux-based OS and other Unix systems;
- CIFS SMBv3 — for connecting the storage to Windows servers.
Once the repository is created, the protocol cannot be changed.
Access rules
NFSv4
CIFS SMBv3
-
Configure the file storage access rules:
- available to all — the storage will be available to any IP address of the private subnet in which it is created;
- access restricted — the storage will be available only to specific IP addresses or private subnets. If you create a file storage without rules, access will be restricted to all IP addresses.
-
If you selected Restricted Access, click Add Rule.
-
Enter the IP address or CIDR of the private subnet, select the access level.
After creating the repository, you can configure new access rules.
-
Configure the file storage access rules:
- available to all — the storage will be available to any IP address of the private subnet in which it is created;
- access restricted — the storage will be available only to specific IP addresses or private subnets. If you create a file storage without rules, access will be restricted to all IP addresses.
-
If you selected Restricted Access, click Add Rule.
-
Enter the IP address or CIDR of the private subnet.
After creating the repository, you can configure new access rules.
-
Create a file storage network:
openstack share network create \
--name <share_network> \
--neutron-net-id <net_uuid> \
--neutron-subnet-id <subnet_uuid>Specify:
<share_network>
— name of the file storage network;<net_uuid>
— ID of the private or public network to which the file storage will be connected. The list of networks can be viewed using the commandopenstack network list
;<subnet_uuid>
— Subnet ID. The list of subnets can be viewed with the commandopenstack subnet list
.
-
Create file storage:
openstack share create <share_protocol> <share_size>\
--name <share_name> \
--share-network <share_network_id> \
--share-type <share_type_name>Specify:
<share_protocol>
— NFSv4 or CIFS SMBv3 file storage connection protocol;<share_size>
— file storage size in GB;<share_name>
— name of the file storage;<share_network_id>
— The ID of the file storage network you created in step 2. You can view the list of file storage networks using the commandopenstack share network list
;<share_type_name>
— file storage type. The list of types can be viewed with the commandopenstack share type list
.
Use the Create File Storage instructions in the Terraform documentation.
2. Create a cloud server in the target project
Use the instructions to Create a cloud server.
Select the private subnet of the file storage you created in step 1.
3. Create a global router
- In the Control Panel, on the top menu, click Products and select Global Router.
- Click Create router. Each account has a limit of five global routers.
- Enter the name of the router.
- Click Create.
- If the router is created with the status
ERROR
or hangs in one of the statuses, create a ticket.
4. Add the port for the cloud server to the subnet of the target project
Use the Add a port to a subnet instruction.
Specify:
- subnet of the file storage subnet of the source project;
- The IP address of the cloud server you created in step 2.
5. Connect the networks and subnets of the source and target projects to the router
You need to connect the networks and subnets to the global router up to those cloud platform projects and pools that host the source file storage and the target file storage with the cloud server.
-
Verify 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 → verify that there is no Global Router tag in the network card .
-
Verify that the subnet meets the conditions:
- belongs to the RFC 1918 private address range:
10.0.0.0/8
,172.16.0.0/12
, or192.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 the router.
- belongs to the RFC 1918 private address range:
-
In the Dashboard, on the top menu, click Products and select Cloud Servers.
-
Go to Network → Private Networks tab.
-
From the menu of the network, select Connect to Global Router.
-
Select the global router.
-
For the source project subnet, enter the IP address that will be assigned to the router, or leave the first free address from the subnet assigned by default.Do not assign this address to your devices so as not to disrupt the network.The last two free addresses of the subnet will be reserved as service addresses.
-
Click Connect. Do not close the window until you see a message that the network is connected.Then in Control Panel:
-
Repeat steps 5-8 for the target project subnet.
6. Add a static route to the subnet of the source project
Add a static route from the target project subnet to the source project subnet.Use the Configure Static Routes in Subnets instruction.
Specify:
- destination subnet — the subnet of the target project where 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 subnet of the target project
Add a static route from the source project subnet to the destination project subnet.Use the Configure Static Routes in Subnets instruction.
Specify:
- destination subnet — the 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) — the global router port that you created in step 3.
8. Mount file storages to the cloud server and migrate data
During the data migration, file storage resources will be completely utilized.We recommend that you suspend work with the storages for the duration of the migration.
NFSv4
CIFS SMBv3
Linux
Windows
-
Open the CLI.
-
Install the NFS protocol package:
sudo apt install nfs-common
-
Create folders to mount the vaults:
sudo mkdir -p /mnt/nfs_source
sudo mkdir -p /mnt/nfs_target -
Mount the file stores:
sudo mount -vt nfs "<filestorage_source_ip_address>:/shares/share-<mountpoint_uuid>" /mnt/nfs_source
sudo 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 control panel: in the top menu, click Products → File Storage → Storage page → tab Settings → field IP;<filestorage_target_ip_address>
— IP address of the target file storage. You can view it in control panel: in the top menu, click Products → File Storage → Storage page → tab Settings → field IP;<mountpoint_uuuid>
— The ID of the mountpoint. You can look in control panel: in the top menu, click Products → File Storage → Storage page → Block Connection → tab GNU/Linux.
-
Transfer data between storage locations:
rsync -avzhHl --progress /mnt/nfs_source/ /mnt/nfs_target/
To work with file storage from Windows, we recommend using file storage with CIFS protocol. If you want to mount the storage with NFSv4 protocol, install and use a client that supports this protocol, and then mount the file storage. To mount the file storage, refer to the documentation of the selected client.
The file storage works only with NFSv4 version NFS client. By default, Windows supports NFS client versions NFSv2 and NFSv3. For more information about NFS versions, see the Microsoft NFS Documentation Overview article.
Linux
Windows
-
Install the CIFS protocol package:
sudo apt install cifs-utils
-
Create folders to mount the vaults:
sudo mkdir -p /mnt/cifs_source
sudo mkdir -p /mnt/cifs_target -
Mount the file stores:
sudo mount.cifs -o guest "<filestorage_source_ip_address>:/shares/share-<mountpoint_uuid>" /mnt/cifs_source
sudo mount.cifs -o guest "<filestorage_target_ip_address>:/shares/share-<mountpoint_uuid>" /mnt/cifs_targetSpecify:
<filestorage_source_ip_address>
— IP address of the source file storage. You can view it in control panel: in the top menu, click Products → File Storage → Storage page → tab Settings → field IP;<filestorage_target_ip_address>
— IP address of the target file storage. You can view it in control panel: in the top menu, click Products → File Storage → Storage page → tab Settings → field IP;<mountpoint_uuuid>
— The ID of the mountpoint. You can look in control panel: in the top menu, click Products → File Storage → Storage page → Block Connection → tab GNU/Linux.
-
Transfer data between storage locations:
rsync -avzhHl --progress /mnt/cifs_source/ /mnt/cifs_target/
-
Open the CLI.
-
Mount the file storage:
net use X: \\\\<filestorage_source_ip_address>\share-<mountpoint_uuid>
net use Y: \\\\<filestorage_target_ip_address>\share-<mountpoint_uuid>Specify:
<filestorage_source_ip_address>
— IP address of the source file storage. You can view it in control panel: in the top menu, click Products → File Storage → Storage page → tab Settings → field IP;<filestorage_target_ip_address>
— IP address of the target file storage. You can view it in control panel: in the top menu, click Products → File Storage → Storage page → tab Settings → field IP;<mountpoint_uuuid>
— The ID of the mountpoint. You can look in control panel: in the top menu, click Products → File Storage → Storage page → Block Connection → tab Windows.
-
Transfer data between storage locations:
robocopy "X:\" "Y:\" /MIR /Z /FFT /R:3 /W:10 /COPY:DAT /MT:8 /V /NP /LOG:robocopy.log