Re: Possible Setup Error On New /dev/mdX Device

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

 



Thanks very much. Will look into that. Not familiar with MD devices
and this was short notice and  urgent. A lesson for next time I guess.

Regards

On Fri, Jan 18, 2019 at 2:23 PM Andreas Klauer
<Andreas.Klauer@xxxxxxxxxxxxxx> wrote:
>
> On Fri, Jan 18, 2019 at 10:43:54AM +0200, Shaun Glass wrote:
> > # pvcreate /dev/sdf
> > # pvcreate /dev/sdg
> > # fdisk /dev/sdf (Created a partition with type fd)
> > # fdisk /dev/sdg (Created a partition with type fd)
>
> Storage works in layers, and each layer can only be one thing.
>
> So /dev/sdf can be either a PV, or a partition table, not both.
>
> It's convention to make it a partition table and leaving it
> out may cause you grief further down the road, when another
> software sees no partition table and helpfully creates one.
>
> The partition table gives you a new layer (/dev/sdf1) you can
> use for something else.
>
> If you put mdadm on /dev/sdf1 it gives you a new layer (/dev/md1)
> you can use for something else.
>
> If you put LVM on /dev/md1 it gives you a new layer (/dev/vg/lv)
> you can use for something else.
>
> Just one thing per layer, not two or three that conflict with
> one another.
>
> > I did create a VM on my laptop and recreated
> > as per the above and did not see the same result.
>
> If the version of fdisk you are using is smart enough,
> it will detect the PV signature and remove it for you:
>
> | Welcome to fdisk (util-linux 2.33.1).
> | Changes will remain in memory only, until you decide to write them.
> | Be careful before using the write command.
> |
> |!!! The old LVM2_member signature will be removed by a write command. !!!
> |
> | Device does not contain a recognized partition table.
> | Created a new DOS disklabel with disk identifier 0x3eb343d9.
>
> However other versions of fdisk might not do so. For example,
> 'busybox fdisk' does not care about the PV signature at all.
> As it happens to be located at a different offset, than the
> dos partition table, it remains and you end up in confusion.
>
> > How bad is this and can it be corrected ?
>
> 'wipefs' is a tool that searches for magic bytes and removes them.
> It can help you get rid of many unwanted signatures.
>
> # wipefs --no-act /dev/loop0
> |DEVICE OFFSET TYPE        UUID                                   LABEL
> |loop0  0x218  LVM2_member Qp5dGF-gDry-WLwD-rMsY-FKl6-gKTH-0yTR2S
> |loop0  0x1fe  dos
>
> The LVM2_member we want to be rid of is at offset 0x218 so use that...
>
> # wipefs --no-act --offset 0x218 /dev/loop0
> | /dev/loop0: 8 bytes were erased at offset 0x00000218 (LVM2_member): 4c 56 4d 32 20 30 30 31
>
> Remove the --no-act if you're happy with the result.
>
> This is the minimal invasive approach (only a few bytes erased).
> If you know what you're doing you can also zero out the entire
> area before the 1st partition, then restore the partition table.
> Just be careful not to delete too much.
>
> Regards
> Andreas Klauer



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux