Re: Experiments with sswap(1), srm(1), wipe(1), gdisk(8), lsblk and gpart(8)
- Reply: Graham Perrin : "gdisk(8) and geli(8)"
- In reply to: Graham Perrin : "Experiments with sswap(1), srm(1), wipe(1), gdisk(8), lsblk and gpart(8)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Aug 2021 13:50:20 UTC
> … 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=258090#c9> … > Lines 131–139, 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. … > Lines 288–297, gdisk should have deleted /dev/da0p3, I ignored the > suggestion to remove the drive, lsblk showed da0p3 still present. … Today: * sysctl kern.geom.debugflags=16 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=16 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/EFISYS - da4p2 2:117 512K freebsd-boot gpt/gptboot0 - da4p3 2:118 16G freebsd-swap gpt/FreeBSD%20swap - 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 EXISTING 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/EFISYS - da4p2 2:117 512K freebsd-boot gpt/gptboot0 - <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 = 410664) or {+-}size{KMGTP}: Last sector (410664-33966079, default = 33966079) or {+-}size{KMGTP}: Current type is A503 (FreeBSD UFS) Hex code or GUID (L to show codes, Enter = A503): a502 Changed type of partition to 'FreeBSD swap' Command (? for help): w Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING 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/efiboot0 - <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/EFISYS - da4p2 2:117 512K freebsd-boot gpt/gptboot0 - da4p3 2:118 16G freebsd-swap gpt/FreeBSD%20swap - 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 => 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) => 34 976773101 da5 GPT (466G) 34 2014 - free - (1.0M) 2048 976771087 1 freebsd-zfs (466G) => 34 30310333 da6 GPT (14G) 34 2014 - free - (1.0M) 2048 30308319 1 freebsd-zfs (14G) => 34 60437425 da7 GPT (29G) 34 60437425 1 freebsd-zfs (29G) => 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/efiboot0 - <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/EFISYS - da4p2 2:117 512K freebsd-boot gpt/gptboot0 - da4p3 2:118 16G freebsd-swap gpt/FreeBSD%20swap - 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> #