如何在Solus OS下为加密LVM2卷组添加Btrfs RAID1
Quick clarification first: You mentioned formatting the drives as Btrfs RAID1 before adding to LVM, but LVM requires raw, unformatted block devices as physical volumes. The right approach here is to use LVM to set up RAID1 redundancy across the two drives, then format that logical volume with Btrfs. This lets you leverage LVM's volume management (integrating with your existing group) and Btrfs's features like snapshots, while keeping your data redundant.
Alright, let's walk through this safely—here's how to pull it off without breaking your existing Solus setup:
1. Backup Your /home Data First (Non-Negotiable!)
Before touching any storage configuration, make sure you have a full, verified backup of your /home directory. I prefer rsync for incremental, reliable copies, but tar works too:
- Using rsync:
sudo rsync -aXS --exclude='/*/.gvfs' /home/ /path/to/external/backup-drive/home-backup/ - Using tar:
sudo tar -czf /path/to/external/backup-drive/home-backup.tar.gz /home/
Double-check the backup is complete and readable—this is your safety net if anything goes wrong.
2. Identify Your New 1TB Drives
Use lsblk to list all block devices and locate your two 1TB drives. They’ll likely show up as /dev/sdb and /dev/sdc (double-check the size to avoid accidentally overwriting your SSD!):
lsblk
3. Prepare the Drives for LVM
First, wipe any existing partitions or data on the drives (replace sdb and sdc with your actual device names):
sudo wipefs -a /dev/sdb sudo wipefs -a /dev/sdc
Then create physical volumes (PVs) on each drive—this marks them as usable by LVM:
sudo pvcreate /dev/sdb sudo pvcreate /dev/sdc
4. Add the PVs to Your Existing Volume Group
First, find the name of your existing volume group using vgs—Solus typically uses solus by default:
sudo vgs
Now add the new PVs to this volume group to expand its available space:
sudo vgextend solus /dev/sdb /dev/sdc
Confirm the volume group has been extended with vgs—you should see the total size increase by ~2TB (minus small overhead).
5. Create a RAID1 Logical Volume (LV) for Btrfs
Create a logical volume with RAID1 redundancy (using both drives) to host your Btrfs filesystem. Replace home_lv with your preferred LV name; since it’s RAID1, the usable size will be ~1TB:
sudo lvcreate -L 1T -n home_lv --type raid1 solus /dev/sdb /dev/sdc
Wait for the RAID1 sync to complete—you can track progress with:
sudo lvs -o name,copy_percent solus/home_lv
Don’t proceed until copy_percent shows 100%.
6. Format the LV with Btrfs
Now format the new logical volume with Btrfs, and add a label for easier mounting later:
sudo mkfs.btrfs /dev/solus/home_lv sudo btrfs filesystem label /dev/solus/home_lv btrfs_home
7. Migrate /home to the New LV
First, create a temporary mount point for the new Btrfs volume:
sudo mkdir /mnt/temp_home sudo mount /dev/solus/home_lv /mnt/temp_home
Copy your backed-up /home data to the new volume (rsync preserves permissions and hidden files best):
sudo rsync -aXS --exclude='/*/.gvfs' /home/ /mnt/temp_home/
Verify the copy is identical to the original:
sudo diff -r /home/ /mnt/temp_home/
If no differences are found, unmount both the original /home and the temp mount:
sudo umount /home sudo umount /mnt/temp_home
8. Update fstab to Mount the New /home
Edit your /etc/fstab file to set the new Btrfs volume as your permanent /home. First, get the UUID of the LV:
sudo blkid /dev/solus/home_lv
Add a line like this to /etc/fstab (replace the UUID with your actual one):
UUID=your-btrfs-uuid /home btrfs defaults,noatime 0 2
Test the mount to ensure it works:
sudo mount /home
Reboot your system to confirm everything loads correctly. After rebooting, check if /home is mounted properly with df -h or mount.
9. Clean Up (Optional)
Once you confirm everything works, you can reclaim the space from the original /home on your SSD. First, use lsblk to find which logical volume the original /home was on, then reduce that LV’s size (make sure all data is migrated first!) and resize the filesystem on it. Alternatively, leave it as is for extra safety if you don’t need the space.
内容的提问来源于stack exchange,提问作者Enrico Lefass

