You are not logged in.
Pages: 1
In Arch Installation, how can I completely remove file system after deleting partition or removing partition data.
For example, I created partitions and deleted them for some reasons during installation.
Then restart installation from the beginning. So I prepare the disk, as follow for example.
# umount -R /mnt # in case of I mounted the partitions
# swapoff /dev/sda[n] # in case of I did swapon
# sgdisk -o /dev/sda
# wipefs -a /dev/sda
Then I repartition the disk using cgdisk or sgdisk and format the partition.
At this stage, why the following command still prompt the following even if did # wipefs -a /dev/sda
# mkfs.ext4 /dev/sda2
mkfs.fst 4.2 (2021-01-31)
mke2fs 1.47.1 (20-May-2024)
/dev/sda2 contains a ext4 file system
last mounted on /mnt on Mon Aug 19 10:26:52 2024
Proceed anyway? (y,N)
How can I remove everything including that "contains a ext4 file system" from the disk.
Last edited by duyinthee (2024-08-20 04:28:52)
Offline
Wouldn't you want to delete the filesystem signatures before removing the partition table?
Not sure, how about...
# wipefs --all -f /dev/sdx1
# wipefs --all -f /dev/sdx2
# sgdisk --zap-all /dev/sdx
???
Also note,
wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the specified device to make the signatures invisible for libblkid. wipefs does not erase the filesystem itself nor any other data from the device.
"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb
Offline
You can overwrite it with zeros.
dd if=/dev/zero of=/dev/sda status=progress bs=512 conv=noerror,sync
Offline
Do you need to? The only purpose I could imagine would be for security / plausible deniability: if you didn't want anyone who found the disk to even be able to infer it once formerly had a linux filesystem on it. Is this really a concern?
If it is a concern, then either overwrite it with a new filesystem, or overwrite it with zeros as in the last post. But if it's not a concern, then just go on as normal.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks for replies.
Do you need to? The only purpose I could imagine would be for security / plausible deniability: if you didn't want anyone who found the disk to even be able to infer it once formerly had a linux filesystem on it. Is this really a concern?
Yes it is not a really concern but for a scenario in scripting. I had been writing a little script of installing Arch linux for my personal use. Considering what if I needed to restart installing on half way made me curious about removing filesystem and partition table data.
Thanks.
Wouldn't you want to delete the filesystem signatures before removing the partition table?
Not sure, how about...
# wipefs --all -f /dev/sdx1 # wipefs --all -f /dev/sdx2 # sgdisk --zap-all /dev/sdx
Yes, I should do removing filesystem before removing partition table. And wipefs -a must be followed by partition, not device.
You can overwrite it with zeros.
dd if=/dev/zero of=/dev/sda status=progress bs=512 conv=noerror,sync
Thanks for it as well. Straight.
Last edited by duyinthee (2024-08-20 04:28:15)
Offline
I had been writing a little script of installing Arch linux for my personal use. Considering what if I needed to restart installing on half way
then you should fix your script rather than thinking about a xy-problem
install scripts usually go fully automatic (unattended rapid mass deployment) or like archinstall assist experienced users in a semi-automated way
if you feel the need for restart over you do it wrong: semi-automated scripts should gather information - display them with option to edit some entries - and do all stuff in one go after final confirmation
restarting half way thru hints to a design flaw of the script
Offline
...
I disagree with pretty much all that. When working in any endeavor we are often surprised by unexpected twists. Seeing such a twist and making it into a learning opportunity is what engaged, thoughtful, and intelligent minds do. Learning about something you are unfamiliar with is not the X of an XY problem.
As for all the other statements about what install scripts must do, who the hell came up with those rules? Those criteria may be what cryptearth wants in a install script - but implying that everyone else's personal scripting projects much conform to your goals is ... <sentence left to complete as an exercise for the reader>
Last edited by Trilby (2024-08-20 12:10:25)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
who the hell came up with those rules?
next time you should do your homework:
fully automated:
windows unattend.xml https://learn.microsoft.com/en-us/windo … windows-11
opensuse autoyast: https://doc.opensuse.org/projects/autoyast/
collecting informations upfront, present them in a list and the do in one go: that's regular yast2 installer works
calling me out? ok - but do it right buddy
it'not ME who came up with this - but the industry does it for decades - I just follow established practices
doing step by step? ok - let me turn this upside-down: most people write one list and do one trip to the store - your way woukd result in something more like writing several lists and doing several trips - show me ONE person who does this
this very question shows the flaw: what if I screw up half way? it's exactly THAT what most installers prevent: by asking all questions first - then show a list to check and potential fix mistakes - and then perform actions at once
Offline
show me ONE person who does this
Why, so you can ridicule them too for not doing things the way you do?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
what if I needed to restart installing on half way
I just wanted to mean that how should I properly delete partitions or create space or prepare the whole disk beforehand if I am required to do so. Sorry for misleading.
Offline
Pages: 1