Re: md0 + UUIDs for member disks

2023-12-31 Thread Felix Natter
hello Andy,

thanks for the detailed answer.

Andy Smith  writes:
> Hello,
>
> On Fri, Dec 29, 2023 at 06:17:07PM +0100, Felix Natter wrote:
>> Andy Smith  writes:
>> > But to be absolutely sure you may wish to totally ignore md0 and
>> > its member devices during install as all their data and the
>> > metadata on their member devices will still be there after
>> > install. You should just be able to see the assembled array in
>> > /proc/mdstat, and then mount the filesystem from /etc/fstab.
>> > Totally ignoring these devices during install avoids you making
>> > a mistake where you alter one of them.

-> I was referring to the above paragraph.

>> So /dev/md0 will be automatically assembled when I boot the system
>> (cat /proc/mdstat), and I can mount it using UUID?
>
> Yes, if the filesystem on /dev/md0 had a UUID before, it will still
> have one when the devices are plugged in to another system (or the
> same system after a reinstall).

That is very good.

>> I couldn't do this on another system, where the software raid(1) is for
>> the root filesystem, though. But as I understood you, in the case of the
>> root fs, the above mentioned problem does not occur?
>
> What problem do you refer to?

Please see above.

> The only thing that does sometimes happen when moving MD arrays
> around is that the name of the md device might need to be changed.
>
> For example, if you have a set of drives that have an md0 on them
> and want to move them to a system that already has an md0. The new
> system won't assemble that as md0 since it already has an md0 that
> has a different UUID. Worse, if you don't do anything and boot such
> a system with all the drives installed, it may be arbitrary as to
> WHICH ONE gets called md0! It will depend upon which one mdadm
> starts assembling first. The other one will be renamed, often to
> something weird like md127.
>
> To solve that problem one would list the pairs of array names and
> array UUIDs in /etc/mdadm/mdadm.conf. If the root filesystem is on
> an md array then the initramfs also has to be updated, to get a copy
> of mdadm.conf into that.
>
> But that is a bit of an advanced concern that you probably do not
> have. Normally /etc/mdadm/mdadm.conf is basically empty.

I am using single raid1 setups, so this does not concern me,
but many thanks for the heads-up!

Thanks and Best Regards,
Felix
-- 
Felix Natter




Re: md0 + UUIDs for member disks

2023-12-29 Thread Andy Smith
Hello,

On Fri, Dec 29, 2023 at 06:17:07PM +0100, Felix Natter wrote:
> Andy Smith  writes:
> > But to be absolutely sure you may wish to totally ignore md0 and
> > its member devices during install as all their data and the
> > metadata on their member devices will still be there after
> > install. You should just be able to see the assembled array in
> > /proc/mdstat, and then mount the filesystem from /etc/fstab.
> > Totally ignoring these devices during install avoids you making
> > a mistake where you alter one of them.
> 
> So /dev/md0 will be automatically assembled when I boot the system
> (cat /proc/mdstat), and I can mount it using UUID?

Yes, if the filesystem on /dev/md0 had a UUID before, it will still
have one when the devices are plugged in to another system (or the
same system after a reinstall).

> I couldn't do this on another system, where the software raid(1) is for
> the root filesystem, though. But as I understood you, in the case of the
> root fs, the above mentioned problem does not occur?

What problem do you refer to?

The only thing that does sometimes happen when moving MD arrays
around is that the name of the md device might need to be changed.

For example, if you have a set of drives that have an md0 on them
and want to move them to a system that already has an md0. The new
system won't assemble that as md0 since it already has an md0 that
has a different UUID. Worse, if you don't do anything and boot such
a system with all the drives installed, it may be arbitrary as to
WHICH ONE gets called md0! It will depend upon which one mdadm
starts assembling first. The other one will be renamed, often to
something weird like md127.

To solve that problem one would list the pairs of array names and
array UUIDs in /etc/mdadm/mdadm.conf. If the root filesystem is on
an md array then the initramfs also has to be updated, to get a copy
of mdadm.conf into that.

But that is a bit of an advanced concern that you probably do not
have. Normally /etc/mdadm/mdadm.conf is basically empty.

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



Re: md0 + UUIDs for member disks

2023-12-29 Thread Felix Natter
hi Steve,

thanks for the quick reply!

Steve McIntyre  writes:
> fnat...@gmx.net wrote:
>>
>>I have /dev/md0 mounted at /storage which consists of two HDDs.
>>
>>Now I would like to add an SSD drive for better performance of
>>VMs. Usually, before doing this, I make sure that all of my disks are
>>mounted using UUID and not device names. I do not think this is
>>the case for the two member HDDs of md0 (cat /proc/mdstat).
>>Is there an easy way to fix this?
>>
>>If I need to reinstall, can I keep the two member HDDs with all the
>>data, i.e. does the Debian12 installer recognize the member HDDs
>>and will allow me to configure /dev/md0?
>
> The reason behing using UUIDs is that individual disks don't have
> persistent names attached: /dev/sda might be /dev/sdb next time, etc.
>
> MD RAID devices *do* include persistent metadata so that the system
> can recognise them reliably. You should be fine as you are.

Thanks for the help, this was what I needed.

Cheers and Best Regards,
Felix
-- 
Felix Natter




Re: md0 + UUIDs for member disks

2023-12-29 Thread Felix Natter
Andy Smith  writes:

> Hi Felix,

hello Andy,

thank you for the quick reply!

> On Fri, Dec 29, 2023 at 04:46:10PM +0100, Felix Natter wrote:
>> I have /dev/md0 mounted at /storage which consists of two HDDs.
>> 
>> Now I would like to add an SSD drive for better performance of
>> VMs. Usually, before doing this, I make sure that all of my disks are
>> mounted using UUID and not device names. I do not think this is
>> the case for the two member HDDs of md0 (cat /proc/mdstat).
>> Is there an easy way to fix this?
>
> What are you trying to fix? Filesystems have a UUID. MD RAID devices
> have a UID. And MD RAID member devices also have UUIDs, but they are
> all different *kinds* of UUID. Only filesystems have a filesystem
> UUID that you use in /etc/fstab and other places. You mount things
> by filesystem UUID. You don't mount MD RAID member devices; mdadm
> assembles them.
>
> RAID assembly normally happens automatically by udev finding block
> devices that have the same array id as the one that mdadm is trying
> to incrementally assemble, until all their member devices are found.
>
> So what is it that you are actually wanting to do? If you just want
> to mount whatever filesystem is on md0 by *filesystem* UUID, you do
> that in the normal way as it has nothing to do with MD: you use
> blkid or tune2fs or whatever to read the fs label and put that in
> /etc/fstab.

I was just worried that devices (i.e. /dev/sdx) will change when adding
another drive. I understand that Debian's SW-RAID assembly does not
refer to disks via device names :)

>> If I need to reinstall, can I keep the two member HDDs with all the
>> data, i.e. does the Debian12 installer recognize the member HDDs
>> and will allow me to configure /dev/md0?
>
> Yes. When you come to the partitioning and software RAID section of
> the installer your existing md0 should already be there.

That's very good!

> But to be
> absolutely sure you may wish to totally ignore md0 and its member
> devices during install as all their data and the metadata on their
> member devices will still be there after install. You should just
> be able to see the assembled array in /proc/mdstat, and then mount
> the filesystem from /etc/fstab. Totally ignoring these devices
> during install avoids you making a mistake where you alter one of
> them.

So /dev/md0 will be automatically assembled when I boot the system
(cat /proc/mdstat), and I can mount it using UUID?

I couldn't do this on another system, where the software raid(1) is for
the root filesystem, though. But as I understood you, in the case of the
root fs, the above mentioned problem does not occur?

Many Thanks and Best Regards,
Felix
-- 
Felix Natter




Re: md0 + UUIDs for member disks

2023-12-29 Thread Steve McIntyre
fnat...@gmx.net wrote:
>
>I have /dev/md0 mounted at /storage which consists of two HDDs.
>
>Now I would like to add an SSD drive for better performance of
>VMs. Usually, before doing this, I make sure that all of my disks are
>mounted using UUID and not device names. I do not think this is
>the case for the two member HDDs of md0 (cat /proc/mdstat).
>Is there an easy way to fix this?
>
>If I need to reinstall, can I keep the two member HDDs with all the
>data, i.e. does the Debian12 installer recognize the member HDDs
>and will allow me to configure /dev/md0?

The reason behing using UUIDs is that individual disks don't have
persistent names attached: /dev/sda might be /dev/sdb next time, etc.

MD RAID devices *do* include persistent metadata so that the system
can recognise them reliably. You should be fine as you are.

-- 
Steve McIntyre, Cambridge, UK.st...@einval.com
Can't keep my eyes from the circling sky,
Tongue-tied & twisted, Just an earth-bound misfit, I...



Re: md0 + UUIDs for member disks

2023-12-29 Thread Andy Smith
Hi Felix,

On Fri, Dec 29, 2023 at 04:46:10PM +0100, Felix Natter wrote:
> I have /dev/md0 mounted at /storage which consists of two HDDs.
> 
> Now I would like to add an SSD drive for better performance of
> VMs. Usually, before doing this, I make sure that all of my disks are
> mounted using UUID and not device names. I do not think this is
> the case for the two member HDDs of md0 (cat /proc/mdstat).
> Is there an easy way to fix this?

What are you trying to fix? Filesystems have a UUID. MD RAID devices
have a UID. And MD RAID member devices also have UUIDs, but they are
all different *kinds* of UUID. Only filesystems have a filesystem
UUID that you use in /etc/fstab and other places. You mount things
by filesystem UUID. You don't mount MD RAID member devices; mdadm
assembles them.

RAID assembly normally happens automatically by udev finding block
devices that have the same array id as the one that mdadm is trying
to incrementally assemble, until all their member devices are found.

So what is it that you are actually wanting to do? If you just want
to mount whatever filesystem is on md0 by *filesystem* UUID, you do
that in the normal way as it has nothing to do with MD: you use
blkid or tune2fs or whatever to read the fs label and put that in
/etc/fstab.

> If I need to reinstall, can I keep the two member HDDs with all the
> data, i.e. does the Debian12 installer recognize the member HDDs
> and will allow me to configure /dev/md0?

Yes. When you come to the partitioning and software RAID section of
the installer your existing md0 should already be there. But to be
absolutely sure you may wish to totally ignore md0 and its member
devices during install as all their data and the metadata on their
member devices will still be there after install. You should just
be able to see the assembled array in /proc/mdstat, and then mount
the filesystem from /etc/fstab. Totally ignoring these devices
during install avoids you making a mistake where you alter one of
them.

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting



md0 + UUIDs for member disks

2023-12-29 Thread Felix Natter
hello Debian experts,

I have /dev/md0 mounted at /storage which consists of two HDDs.

Now I would like to add an SSD drive for better performance of
VMs. Usually, before doing this, I make sure that all of my disks are
mounted using UUID and not device names. I do not think this is
the case for the two member HDDs of md0 (cat /proc/mdstat).
Is there an easy way to fix this?

If I need to reinstall, can I keep the two member HDDs with all the
data, i.e. does the Debian12 installer recognize the member HDDs
and will allow me to configure /dev/md0?

Many Thanks and Best Regards,
Felix
-- 
Felix Natter