Starlight Internet vps host data disk mounting tutorial

888u

Last update at :2023-12-28,Edit by888u

The three special VPS hosts recently released by Starlight Internet in three data centers in Hong Kong, Japan and South Korea are very popular. I also bought a data center with Shatian node in Hong Kong for the first time. It can be said that Korean vps hosts are replenished again and again and are very popular. Due to price reasons, too many people stay and there is a lot of trouble. The installation and configuration environment is sometimes difficult, so some friends cannot do it well. It’s time to play!

Xingguang Mei’s vps host uses KVM virtualization technology, but the data disk is not mounted and needs to be mounted by yourself. Thinking that it may be useful for some partners, this site directly moved the mounting tutorial published by Xingguang Mei. After your own testing, it is completely usable!

Relevant knowledge:

/dev/vda – system disk
— /dev/vda1 – /boot, stores system startup related files
— /dev/vda2 – LVM physical volume (contains /)
/dev/vdb – data disk
— /dev/vdb1 – /home
/dev/vdc – system initialization file

This structure uses the panel's system reinstallation function to reinstall Linux, and the data on the data disk will not be lost.

Initial partition related operations

1. Synchronize the update source and install related software.
Debian & Ubuntu:

apt-get update
apt-get -y install kpartx lvm2

CentOS & Fedora:

yum -y install kpartx lvm2

Warning: The following steps will cause the original data in /dev/vdb to be completely lost. Please ensure that the data in /dev/vdb has been backed up.
2. Clear the partition table of /dev/vdb.

kpartx -d /dev/vdb
dd if=/dev/zero of=/dev/vdb bs=512 count=1

3. Create a partition on /dev/vdb:

fdisk /dev/vdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x1ea1ca70.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n #Enter n to create a new partition
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): #Enter p, or press Enter directly to create a primary partition (up to four primary partitions)
Using default response p
Partition number (1-4, default 1): #Enter the number of the new partition, or press Enter directly. Please note that the partition number cannot be repeated
Using default value 1
First sector (2048-67108863, default 2048): #Enter the starting sector and press Enter to use the default value
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-67108863, default 67108863): #Input the ending sector, support + the number of sectors (indicates that the result of the starting sector + the number of sectors is used as the termination sectors), or + capacity, such as +5G (fdisk will automatically calculate how many sectors are needed for 5 Gbytes, and use the result of the starting sector + the number of sectors required for 5 Gbytes as the ending sector). Enter Enter directly to use the default value
Using default value 67108863

Command (m for help): t #Enter t to change the partition type
Selected partition 1 #If there is only one partition, the only partition will be automatically selected, otherwise you need to manually enter the partition number
Hex code (type L to list codes): 83 #Enter 83 to indicate Linux partition
Changed system type of partition 1 to 83 (Linux)

Command (m for help): w #Enter w to save partition information. Warning: Once the save operation is performed, it cannot be undone. Please ensure that there is no problem with the above operations. Otherwise, please enter q, do not save the partition table, and exit
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

4. Format the partition as ext4. If you need other formats, please change it yourself.

mkfs.ext4 /dev/vdb1

5. Modify the configuration file of the mounted partition.

echo "/dev/vdb1 /home ext4 defaults 0 1" >> /etc/fstab

6. Mount the partition.

mount -a

7. Check

df -h

Filesystem Size Used Avail Use% Mounted on
rootfs 4.5G 801M 3.5G 19% /
udev 10M 0 10M 0% /dev
tmpfs 101M 224K 101M 1% /run
/dev/mapper/debian-root 4.5G 801M 3.5G 19% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 201M 0 201M 0% /run/shm
/dev/vda1 472M 28M 420M 7% /boot
/dev/vdb1 50G 180M 47G 1% /home

Operations after reinstalling the system

1. Synchronize the update source and install related software.
Debian & Ubuntu:

apt-get update
apt-get -y install kpartx lvm2

CentOS & Fedora:

yum -y install kpartx lvm2

2. Modify the configuration file of the mounted partition.

echo "/dev/vdb1 /home ext4 defaults 0 1" >> /etc/fstab

3. Mount the partition.

mount -a

4. Check

df -h

Filesystem Size Used Avail Use% Mounted on
rootfs 4.5G 801M 3.5G 19% /
udev 10M 0 10M 0% /dev
tmpfs 101M 224K 101M 1% /run
/dev/mapper/debian-root 4.5G 801M 3.5G 19% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 201M 0 201M 0% /run/shm
/dev/vda1 472M 28M 420M 7% /boot
/dev/vdb1 50G 180M 47G 1% /home

Recommended site searches: dual-line dual-ip, registered domain name, Hong Kong cloud host, free asp.net space, virtual host evaluation, Chinese domain name query, US server rental, Hong Kong virtual host, free php mysql space, US anti-attack server ,

Starlight Internet vps host data disk mounting tutorial

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码