Howdy,
I have a few drives that I have been using for system backups. Im going to redo my backup scheme so I want to scrap everything that's on these drives already and start out fresh with empty file systems.
As there are millions of files on these drives, to delete all the files on them would take forever and who knows if it could lead to corruption or not. Basically I just want to start over again with fresh empty file systems.(*)
Also I do not recall all the steps I went through to set up the drives in the first place, I was following various recipes. Somehow I managed to get them partitioned, encrypted, mapped by /dev/mapper, and given entries in /etc/fstab and /etc/crypttab with UUIDs, to auto-mount using keyfiles to open/mount. I am afraid anything I might do would break some aspect of all of this. (Sorry for the n00b question)
Can I use the mkfs.ext4 command to just wipe one of these partitions clean and not break the rest of the setup? The drives are on external devices, encrypted with LUKS2. They are not part of a logical volume scheme.
For example, this is what one of them looks like in lsblk:
Somehow I have also mapped this drive to /dev/mapper/backup2, but I dont recall how I did that. Just following recipes.Code:sdb 8:16 0 4.6T 0 disk └─sdb1 8:17 0 4.6T 0 part └─backup2 253:7 0 4.6T 0 crypt /media/user/backup2
Is there a simple command I could issue to just redo the file system on this drive from scratch while not messing anything else up?
Rabu
(*)
I have found however for anyone interested, that the fastest way to delete all the files in a directory is to rsync the directory with an empty directory, much faster than rm or find -exec rm.
eg
mkdir empty
rsync -a --delete empty/ directorytodelete/
Bookmarks