Blog / Linux/ Building a CentOS Local Backup Server with Starry Snail Model A (LVM Storage Configuration)

Building a CentOS Local Backup Server with Starry Snail Model A (LVM Storage Configuration)

使用星际蜗牛A款搭建CentOS本地备份服务器(LVM存储配置)

Configuring and Using a Starry Snail Model A as a Local Backup Server

The Starry Snail is a hardware device designed for NAS applications, known for market-driven price fluctuations. This article documents my process of purchasing a Gigabit Ethernet Model A for 400 RMB, installing CentOS 7.2, and configuring it as a local data backup server.

Hardware and System Preparation

The device is a Starry Snail Model A in good internal condition. The seller pre-installed CentOS 7.2 64-bit. Initial setup was performed via HDMI connected to a TV.

Network Configuration

After system installation, manual network configuration is required. Edit the network interface configuration file (note: the interface name may vary; ifcfg-enp3s0 is used as an example):

vi /etc/sysconfig/network-scripts/ifcfg-enp3s0

Change to a static IP configuration. Example below (adjust according to your network environment):

TYPE=Ethernet
BOOTPROTO=static
NAME=enp3s0
DEVICE=enp3s0
ONBOOT=yes
IPADDR=192.168.1.66
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1

Save the file and restart the network service:

systemctl restart network

After configuration, it's recommended to switch to the Alibaba Cloud yum repository, run yum update to update the system, and install essential tools like screen. Test connectivity with the ping command.

Hard Disk Formatting and Partitioning

Install a 1TB hard drive (originally a mobile hard drive with NTFS format) into the machine. Due to limited Linux support for Windows partitions, reformatting is necessary.

Warning: This operation will erase all data on the drive. Back up any important data first.

Use the parted tool to change the disk label type to GPT and create a partition:

parted /dev/sdb
mklabel gpt
mkpart primary ext4 0% 100%
quit

Create a filesystem on the partition:

mkfs.ext4 /dev/sdb1

Creating an LVM Logical Volume

To facilitate future storage expansion, add the partition to LVM management.

Create a physical volume, volume group, and logical volume:

pvcreate /dev/sdb1
vgcreate vg_data /dev/sdb1
lvcreate -l 100%FREE -n lv_data vg_data

Create a filesystem on the logical volume:

mkfs.ext4 /dev/vg_data/lv_data

Important: Always format the logical volume before mounting it to avoid write errors.

Mounting and Auto-Mount Configuration

Create a mount point and configure /etc/fstab for automatic mounting at boot:

mkdir /webbackup
echo '/dev/mapper/vg_data-lv_data /webbackup ext4 defaults 0 0' >> /etc/fstab
mount -a

Use the df -h command to verify a successful mount.

Summary and Next Steps

At this point, the Starry Snail is configured with network and LVM storage on a single hard drive, ready to serve as a basic local backup server. Future steps include adding more hard drives to expand the LVM volume group, making full use of the four available drive bays.

Post a Comment

Your email will not be published. Required fields are marked with *.