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

Re: Raid 1



On 2021-01-23 07:01, mick crane wrote:
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 ?

The "raid thing" is a separate layer below the partitions and file
systems.

Technically it is possible to create the mirror with just one device (I
believe mdadm calls this "degraded"), partition the md mirror device,
install, copy data to it, etc., add the second device later and let md
synchronize the two drives.

Because Linux RAID is a separate layer with no knowledge of the data
"above" it has to copy every single bit to the other drive as well
(similar to a dd device-to-device copy), regardless if actually needed
or not.

If you are really strapped for space and must do this ZFS can do it much
more efficiently, because it controls the entire "stack" and knows
exactly which blocks to copy (besides many other advantages over Linux
RAID).

Unfortunately ZFS is slightly more complicated from the packaging side,
and installing Debian on a ZFS root is difficult.

It still makes an excelent choice to manage your storage drives,
especially on a stable system, where there is less hassle with the dkms
module and it's amazingly simple to use once you familiarise yourself
with the basics.

Kind regards,
Andrei

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 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"

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 ?

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 ?


RAID protects against storage device sectors going bad and against entire storage devices going bad -- e.g. hard disk drives, solid state drives, etc..


Backups protect against filesystem contents going bad -- e.g. files, directories, metadata, etc..


While putting an operating system and backups within a single RAID can be done, this will complicate creation of a ZFS pool and will complicate disaster preparedness/ recovery procedures. The following instructions assume your OS is on one device and that you will dedicate two HDD's to ZFS.


See "Creating a Mirrored Storage Pool":

https://docs.oracle.com/cd/E19253-01/819-5461/gaynr/index.html


The above URL is good for concepts, but the virtual device names ('c1d0', 'c2d0') are for Solaris. For Debian, you will want to zero-fill both HDD's with dd(1) and then create the pool with zpool(8) using device identity nodes:

    /dev/disk/by-id/ata-...


Be extremely careful that you specify the correct devices!


ZFS will mark the drives and create a ZFS pool named 'tank' mounted at '/tank'. Note the parallel namespaces -- 'tank'is ZFS namespace and has no leading slash, while '/tank' is a Unix absolute path.


'/tank' is a ZFS filesystem that can do everything a normal Unix directory can do. So, you could create a directory for backups and create directories for specific machines:

# mkdir /tank/backup

# mkdir /tank/backup/pc1

# mkdir /tank/backup/pc2


Or, you could create a ZFS filesystem for backups and create ZFS filesystems for specific machines:

# zfs create tank/backup

# zfs create tank/backup/pc1

# zfs create tank/backup/pc2


Both will give you directories that you can put your backups into using whatever tools you choose, but the latter will give you additional ZFS capabilities.


David


Reply to: