Zend certified PHP/Magento developer

Rearrange APFS Volumes inside APFS Container

Similarly to this question I’d like to restore factory APFS partition container structure after reinstalling macOS Big Sur from bootable USB flash drive, exactly: make Macintosh HD volume disk1s1 (currently disk1s5) and Macintosh HD - Data volume disk1s2 (currently disk1s1).

This is what factory setup looks like:

diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         1.0 TB     disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.0 TB     disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            15.3 GB    disk1s1
   2:                APFS Volume Macintosh HD - Data     2.7 GB     disk1s2
   3:                APFS Volume Preboot                 284.2 MB   disk1s3
   4:                APFS Volume Recovery                626.3 MB   disk1s4
   5:                APFS Volume VM                      20.5 KB    disk1s5

This is what it looks like right now:

diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI ⁨EFI⁩                     314.6 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         1.0 TB     disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +1.0 TB     disk1
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD - Data⁩     2.5 GB     disk1s1
   2:                APFS Volume ⁨Preboot⁩                 284.2 MB   disk1s2
   3:                APFS Volume ⁨Recovery⁩                626.3 MB   disk1s3
   4:                APFS Volume ⁨VM⁩                      20.5 KB    disk1s4
   5:                APFS Volume ⁨Macintosh HD⁩            15.3 GB    disk1s5
   6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 15.3 GB    disk1s5s1

diskutil apfs list
APFS Container (1 found)
|
+-- Container disk1 10FCC4F5-6143-41E5-9F74-AD9A76AC42EF
    ====================================================
    APFS Container Reference:     disk1
    Size (Capacity Ceiling):      1000240963584 B (1.0 TB)
    Capacity In Use By Volumes:   18980200448 B (19.0 GB) (1.9% used)
    Capacity Not Allocated:       981260763136 B (981.3 GB) (98.1% free)
    |
    +-< Physical Store disk0s2 54848ECD-A4D2-4BDF-A539-6CAB47645CCF
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s2
    |   Size:                       1000240963584 B (1.0 TB)
    |
    +-> Volume disk1s1 07781674-7D00-4803-8FB9-2109E944DDDD
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s1 (Data)
    |   Name:                      Macintosh HD - Data (Case-insensitive)
    |   Mount Point:               /System/Volumes/Data
    |   Capacity Consumed:         2529787904 B (2.5 GB)
    |   Sealed:                    No
    |   FileVault:                 No (Encrypted at rest)
    |
    +-> Volume disk1s2 AB82B314-D19E-4E84-837B-EB188E4B5B3F
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s2 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               /System/Volumes/Preboot
    |   Capacity Consumed:         284155904 B (284.2 MB)
    |   Sealed:                    No
    |   FileVault:                 No
    |
    +-> Volume disk1s3 F7584C45-59AD-4B37-8897-C21D40B0C7A9
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s3 (Recovery)
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         626294784 B (626.3 MB)
    |   Sealed:                    No
    |   FileVault:                 No
    |
    +-> Volume disk1s4 6DDAC30E-71D5-4C75-8F04-9F0B6F4296C5
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s4 (VM)
    |   Name:                      VM (Case-insensitive)
    |   Mount Point:               /System/Volumes/VM
    |   Capacity Consumed:         20480 B (20.5 KB)
    |   Sealed:                    No
    |   FileVault:                 No
    |
    +-> Volume disk1s5 C9027495-7A11-4921-A0D2-0668E7ABE28C
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk1s5 (System)
        Name:                      Macintosh HD (Case-insensitive)
        Mount Point:               Not Mounted
        Capacity Consumed:         15331536896 B (15.3 GB)
        Sealed:                    Broken
        FileVault:                 No (Encrypted at rest)
        |
        Snapshot:                  3E13A161-7421-48DE-8CA1-47FB0C581DC5
        Snapshot Disk:             disk1s5s1
        Snapshot Mount Point:      /
        Snapshot Sealed:           Yes

sudo gpt -r show /dev/disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2          4         Pri GPT table
          6      76800      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      76806  244199454      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  244276260          4         Sec GPT table
  244276264          1         Sec GPT header

I have prepared a bootable macOS Big Sur running from external drive. However I’m not sure how do I achieve what I need. I’ve examined diskutil man on apfs and an article about creating APFS Fusion Drive by hand but could’t come up with the idea how to do what I need. I’m not afraid to edit internal drive, there’s no user data on it currently, just a fresh copy of macOS (if something goes wrong I can reinstall from USB flash drive again).

Please help!