[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Raid 1



mick crane writes:

On 2021-01-23 12:20, Andrei POPESCU wrote:
On Vi, 22 ian 21, 22:26:46, mick crane wrote:
hello,
I want to tidy things up as suggested.
Have one old PC that I'll put 2 disks in and tidy everything up so what's
scattered about is on the running disks and this new/old one is just backup
for them.
Can I assume that Debian installer in some expert mode will sort out the
raid or do I need to install to one disk and then mirror it manually before
invoking the raid thing ?

[...]

Sigh, OK I take advice and have a go.
Really I just want to get on and do some drawings or something but I think I'll thank myself later if I get proper backup in place.
If after having a quick look am I understanding anything?
Partition and install minimal Debian with no X or anything on just one disk.
install headers and zfs-utils.
Add other disk and then what ? To make it a mirror pool (like raid1) does zfs take care of the partitions. Do I want to delete all partitions on other disk first or make like for like partitions?

If I get your scenario correctly you want to install Debian (without ZFS i.e. not "root on ZFS") and then create a ZFS mirror?

If yes, then as a preparation you need either (a) two entire devices of ~ same size to use with ZFS or (b) two partitions to use with ZFS.

Say you install as follows:

* sda1: OS
* sda2: Swap
* sda : XX GiB free

* sdb: XX+ Gib free

Then prepare two unformatted partitions:

* sda3: XX GiB "for ZFS"
* sdb1: XX GiB "for ZFS"

and use these devices for ZFS.

If that's done and I've made a zpool called "backup" from then on the ZFS is nothing to do with the kernel ?
I ask kernel make a directory "my_pc1"
then
"zfs create -o mountpoint=/my_pc1 backup/my_pc1"

You can specifiy a mountpoint and it will be created automatically. No need to pre-create the Directory as with other file systems.

I ask kernel make a directory "my_pc2"
then
"zfs create -o mountpoint=/my_pc2 backup/my_pc2"

So then I can copy files from other PC (pc1) to "my_backup_pc/backup/my_pc1" and ZFS mirrors the data to other disk in pool ?

Yes. In case you are unsure check the output of `zpool status` to see the structure as understood by ZFS.

If that's how it works I'll just need something on the backup_pc and the other PCs to automate the backing up.
Is that backup Ninja or something ?

I have never used backup Ninja. Depending on your use case anything from simple rsync to borgbackup may serve :)

Please note that "root on ZFS" is possible but quite complicated:
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Buster%20Root%20on%20ZFS.html

For my current system I actually used mdadm RAID 1 for OS+Swap and ZFS mirrors for the actual data. This way, I can use the Debian Installer for installation purposes and benefit from the bit rot protection for the acutally important data while maintaining basic redundancy for the OS installation. YMMV.

Here are my notes on essential ZFS commands (in case they might be of help):
https://masysma.lima-city.de/37/zfs_commands_shortref.xhtml

HTH
Linux-Fan

öö

Attachment: pgpXbY7il430_.pgp
Description: PGP signature


Reply to: