Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Aug 2021 14:50:20 +0100
From:      Graham Perrin <grahamperrin@gmail.com>
To:        FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: Experiments with sswap(1), srm(1), wipe(1), gdisk(8), lsblk and gpart(8)
Message-ID:  <CALvFMRyceEVkWP_rkXP0qMvMOvy0v5=KUxd8raBMzX8ipGzs1A@mail.gmail.com>
In-Reply-To: <abe6d141-7893-f7c8-257f-aacd52c5cd2b@gmail.com>
References:  <d1776d44-55fa-2acc-6046-7e29b2e5b1a2@gmail.com> <149845085.13.1630055426223@localhost> <a87cfab9-ea7f-f589-5fe3-fb22a93a1386@gmail.com> <abe6d141-7893-f7c8-257f-aacd52c5cd2b@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> =E2=80=A6 I'll report what might be an obscure bug in lsblk.

Fixed but not yet in ports:
<https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258090#c9>;

=E2=80=A6

> Lines 131=E2=80=93139, gdisk should have added freebsd-swap at /dev/da0p3=
, I
> ignored the suggestion to remove the hard disk drive ("Warning: The
> kernel may continue to use old or deleted partitions."), gpart then
> showed nothing (free space) where da0p3 was expected.

=E2=80=A6

> Lines 288=E2=80=93297, gdisk should have deleted /dev/da0p3, I ignored th=
e
> suggestion to remove the drive, lsblk showed da0p3 still present.

=E2=80=A6

Today:

*   sysctl kern.geom.debugflags=3D16
    was not required

*   things were as expected following each run of gdisk,
    ignoring the warnings about the kernel continuing to use
    old or deleted partitions.

<https://www.rodsbooks.com/gdisk/>; puts kern.geom.debugflags=3D16 in
context. I'm not sure why it was required yesterday.

----

# /usr/home/grahamperrin/dev/lsblk/lsblk da4
DEVICE         MAJ:MIN SIZE TYPE
   LABEL MOUNT
da4              2:115 466G GPT
       - -
 da4p1          2:116 200M efi                                  msdosfs/EFI=
SYS -
 da4p2          2:117 512K freebsd-boot                           gpt/gptbo=
ot0 -
 da4p3          2:118  16G freebsd-swap                     gpt/FreeBSD%20s=
wap -
 da4p4          2:119 450G freebsd-zfs
gpt/zfs0 <ZFS>
 <FREE>         -:-   4.0K -                                               =
  - -
# srm -lv /dev/da4p3
Using /dev/urandom for random input.
Wipe mode is insecure (two passes [0xff/random])
Wiping /dev/da4p3 Warning: /dev/da4p3 is not a regular file,
rename/unlink only!Warning: Couldn't rename /dev/da4p3 - Operation not
supported
Removed file /dev/da4p3 ... Done
# sysctl sysctl kern.geom.debugflags
kern.geom.debugflags: 0
# gdisk /dev/da4
GPT fdisk (gdisk) version 1.0.8

Partition table scan:
 MBR: protective
 BSD: not present
 APM: not present
 GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): d
Partition number (1-4): 3

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTIN=
G
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/da4.
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
# /usr/home/grahamperrin/dev/lsblk/lsblk da4
DEVICE         MAJ:MIN SIZE TYPE
   LABEL MOUNT
da4              2:115 466G GPT
       - -
 da4p1          2:116 200M efi                                  msdosfs/EFI=
SYS -
 da4p2          2:117 512K freebsd-boot                           gpt/gptbo=
ot0 -
 <FREE>         -:-    16G -                                               =
  - -
 da4p4          2:118 450G freebsd-zfs
gpt/zfs0 <ZFS>
 <FREE>         -:-   4.0K -                                               =
  - -
# gdisk /dev/da4
GPT fdisk (gdisk) version 1.0.8

Partition table scan:
 MBR: protective
 BSD: not present
 APM: not present
 GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): n
Partition number (3-128, default 3):
First sector (410664-976773127, default =3D 410664) or {+-}size{KMGTP}:
Last sector (410664-33966079, default =3D 33966079) or {+-}size{KMGTP}:
Current type is A503 (FreeBSD UFS)
Hex code or GUID (L to show codes, Enter =3D A503): a502
Changed type of partition to 'FreeBSD swap'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTIN=
G
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/da4.
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
# /usr/home/grahamperrin/dev/lsblk/lsblk
DEVICE         MAJ:MIN SIZE TYPE
   LABEL MOUNT
ada0             0:121 932G GPT
       - -
 ada0p1         0:123 260M efi                                    gpt/efibo=
ot0 -
 <FREE>         -:-   1.0M -                                               =
  - -
 ada0p2         0:125  16G freebsd-swap
gpt/swap0 SWAP
 ada0p2.eli     2:76   16G freebsd-swap
      - SWAP
 ada0p3         0:127 915G freebsd-zfs
gpt/zfs0 <ZFS>
 ada0p3.eli     0:135 915G zfs                                             =
  - -
 <FREE>         -:-   708K -                                               =
  - -
da4              2:115 466G GPT
       - -
 da4p1          2:116 200M efi                                  msdosfs/EFI=
SYS -
 da4p2          2:117 512K freebsd-boot                           gpt/gptbo=
ot0 -
 da4p3          2:118  16G freebsd-swap                     gpt/FreeBSD%20s=
wap -
 da4p4          2:119 450G freebsd-zfs
gpt/zfs0 <ZFS>
 <FREE>         -:-   4.0K -                                               =
  - -
da5              0:209 466G GPT
       - -
 <FREE>         -:-   1.0M -                                               =
  - -
 da5p1          0:210 466G freebsd-zfs
gpt/Transcend <ZFS>
da6              0:217  14G GPT
       - -
 <FREE>         -:-   1.0M -                                               =
  - -
 da6p1          0:218  14G freebsd-zfs
gpt/cache-transcend <ZFS>
da7              0:239  29G GPT
       - -
 da7p1          0:240  29G freebsd-zfs
gpt/cache-august <ZFS>
# gpart show
=3D>        40  1953525088  ada0  GPT  (932G)
         40      532480     1  efi  (260M)
     532520        2008        - free -  (1.0M)
     534528    33554432     2  freebsd-swap  (16G)
   34088960  1919434752     3  freebsd-zfs  (915G)
 1953523712        1416        - free -  (708K)

=3D>       34  976773101  da5  GPT  (466G)
        34       2014       - free -  (1.0M)
      2048  976771087    1  freebsd-zfs  (466G)

=3D>      34  30310333  da6  GPT  (14G)
       34      2014       - free -  (1.0M)
     2048  30308319    1  freebsd-zfs  (14G)

=3D>      34  60437425  da7  GPT  (29G)
       34  60437425    1  freebsd-zfs  (29G)

=3D>       40  976773088  da4  GPT  (466G)
        40     409600    1  efi  (200M)
    409640       1024    2  freebsd-boot  (512K)
    410664   33555416    3  freebsd-swap  (16G)
  33966080  942807040    4  freebsd-zfs  (450G)
 976773120          8       - free -  (4.0K)

# /usr/local/sbin/lsblk
DEVICE         MAJ:MIN SIZE TYPE
   LABEL MOUNT
ada0             0:121 932G GPT
       - -
 ada0p1         0:123 260M efi                                    gpt/efibo=
ot0 -
 <FREE>         -:-   1.0M -                                               =
  - -
 ada0p2         0:125  16G freebsd-swap
gpt/swap0 SWAP
 ada0p2.eli     2:76   16G freebsd-swap
      - SWAP
 ada0p3         0:127 915G freebsd-zfs
gpt/zfs0 <ZFS>
 ada0p3.eli     0:135 915G zfs                                             =
  - -
 <FREE>         -:-   708K -                                               =
  - -
cd0              0:129   0B -
       - -
da0              2:105   0B freebsd-swap
       - SWAP
da1              2:107   0B -
       - -
da2              2:108   0B -
       - -
da3              2:109   0B -
       - -
da4              2:115 466G GPT
       - -
 da4p1          2:116 200M efi                                  msdosfs/EFI=
SYS -
 da4p2          2:117 512K freebsd-boot                           gpt/gptbo=
ot0 -
 da4p3          2:118  16G freebsd-swap                     gpt/FreeBSD%20s=
wap -
 da4p4          2:119 450G freebsd-zfs
gpt/zfs0 <ZFS>
 <FREE>         -:-   4.0K -                                               =
  - -
da5              0:209 466G GPT
       - -
 <FREE>         -:-   1.0M -                                               =
  - -
 da5p1          0:210 466G freebsd-zfs
gpt/Transcend <ZFS>
da6              0:217  14G GPT
       - -
 <FREE>         -:-   1.0M -                                               =
  - -
 da6p1          0:218  14G freebsd-zfs
gpt/cache-transcend <ZFS>
da7              0:239  29G GPT
       - -
 da7p1          0:240  29G freebsd-zfs
gpt/cache-august <ZFS>
#



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALvFMRyceEVkWP_rkXP0qMvMOvy0v5=KUxd8raBMzX8ipGzs1A>