New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a generic "cleanupdisk" function. #540
Comments
in my opinion, it is much easier to use specific right tools to do the job. it is very hard to have a generic cleanupdisk function. it is because linux support so many different storage objects. and these objects can be dependent to each other. if the basement object is missed, then you can not reach upper object easily without scanning the whole disk. take one machine in my environment for example: it has two hard disk: sda,sdb each storage object has it's own metadata structure, at beginning/end/middle(lvm lv) of the object. and there are several metadata revisions of each storage object.it is hard for a general tool to track all the changes. but the job is easy for specific right tools (mdadm,lvcreate,mkfs.xfs...). and all these tools has parameters or workarround to overwrite existing metadata. so maybe we just need to make sure the specific tools to deal with the storage object can overwrite existing data correctly, then we are safe. or we can full erase all the disks. but as you said, it will spend too many hours/days to do the job. |
@tbsky, For me it is perfectly o.k. to have for each kind of storage object a separated generic cleanup function. In particluar because I do prefer very much to Keep Separated Stuff Separated ( "KSSS" ;-) cf. what I wrote "on 11 Dec 2014" in #497 |
I know I will enjoy by your hard work when RHEL officially support btrfs someday. I hope it can be there this year :) |
I forgot to reply to your "maybe we just need to make sure the specific tools to deal with the storage object can overwrite existing data correctly": From what I learned during #533 it is not possible that the specific tools overwrite existing data because when the specific tool runs it can be already too late. In #533 it failed for RHEL6 at the partitioning level because of old data of the MD level so that before partitioning the MD tool would have to be run to clean up old MD data. This is exactly the reason why I think we need a generic way how to clean up old data. Perhaps your information may lead to the conclusion that such a generic way is not possible. This would be also a perfectly valid result because then no installer can reliably install on an already used disk with arbitrary old data on it. In this case the solution is to document this and then it is left to the user to make sure in advance that his disks are sufficiently clean and if anything goes wrong because of old data on the disk it is no longer an issue for an installer (in particular rear). |
Only for fun: I predict when RHEL officially supports btrfs, they will devise another special way how one can set up btrfs where my current implementation fails ;-) @tbsky |
Regarding clean up DRBD I found in DRBD uses the last 128 MB of the raw device for metadata This means what @schlomo wrote in #533 "maybe just delete the first and last couple of MB on each previously existing partition?" does not work - specifically I mean "just a couple of MB" is not sufficient (if 128 MB is not "just a couple of MB"). |
I update my suggestion: Wipe the first 256MB, the last 256MB and the On 28 January 2015 at 12:34, Johannes Meixner notifications@github.com
|
@jsmeix the external metadata may make the clean-up more crazy. but I think they still fit schlomo's 256MB plan :-D |
Regarding "wipefs" see also #649 In particular therein see |
@jsmeix wipefs function could be useful indeed. However, we should foresee a fall-back when wipefs is not available, e.g. use dd instead. |
before creating filesystems there, see rear#540 and rear#649 (comment) Currently "when available" means that on has to manually add it to the rear recovery system in in /etc/rear/local.conf via REQUIRED_PROGS=( "${REQUIRED_PROGS[@]}" wipefs ) Making wipefs automatically available to the rear recovery system when it is available in the original system is a next step.
As a first step I implemented in #704 Currently "when available" means that on has to manually add it REQUIRED_PROGS=( "${REQUIRED_PROGS[@]}" wipefs ) cf. #649 (comment) Making wipefs automatically available to the rear recovery system Using another program (e.g. dd) as fallback if wipefs is not available |
With #728 I think this issue is sufficiently fixed. Using another program (e.g. dd) as fallback if wipefs is not available |
With #728 this issue is sufficiently fixed. |
Right now (during #732) I detected that in some cases one must use wipefs -a -f /dev/sdXn because without '-f' (--force) wipefs will not erase a partition table I had the strange case that wipefs detected a DOS partition table With the DOS partition table at the beginning of /dev/sda2 Probably it is even a bug when "rear recover" hangs Perhaps an alternative to "wipefs -a -f /dev/sdXn" is mkfs.ext4 -F /dev/sdXn I will think a bit about it what is better. Currently I perefer the generic way via "wipefs -a -f..." I only need to ensure to never do "wipefs -a -f /dev/sda" |
It is still a SUSE-specific hack. Not at all generic. But it works! See rear#732 Additionally it uses "wipefs -f". See rear#540 (comment)
hi jsmeix: I don't use ext4 so I am surprised about your finding. as I said I don't think wipefs can detect/clean complicated storage object (like stacking of mdadm/drbd/lvm), so the correct behavior of specific storage tools is the last rescue. all the tools I need in rear now has correct behavior like below:
so I think no matter what wipefs can do, "mkfs.ext4 -F" is must to be last rescue. |
it's maybe off topic. as you mentioned, the original problem wipefs want to solve is like issue #533. in my case I found two kinds of "automatic behavior": the first is from boot module loading, which cause issues like #480 and #626. we can blacklist useless modules, or maybe whitelist useful modules after booting. I don't know if there are general ways to do this for every distribution. maybe hide the modules at the beginning and unhide them after booting? the second comes from udev event, which cause issues like #518. at first I think solve the issue via udevadm is a great idea. but unfortunately SuSE also try to solve the same problem so the two patches conflict hence issue #533. I don't know if hide/unhide the modules will help stopping these kind of "automatic behavior". but as there will more storage modules in the future, if we can find a general way to handle the "automatic behavior" then rear will be much easier to re-create these storage object. |
It is still a SUSE-specific hack. Not at all generic. But it works! See rear#732 Additionally it uses "wipefs -f". See rear#540 (comment)
I close this one because it is "somewhat done" for version 1.18 and probably it will become "mostly obsoleted" by #799 which might even (hopefully) really fix those issues. |
I think rear needs a generic "cleanupdisk" function that basically makes an already used harddisk behave as if it was a new harddisk.
When recovery is done on an already used harddisk, the still existing old data on the disk cause varius kind of unexpected weird failures where each kind is difficult to reproduce (because it depends on what exact old data there is).
For some example see #533 (therein the issue that on RHEL6 on a used disk mdadm interferes with parted) and #415 ("mkfs -t btrfs" needs option "-f" to enfore making a btrfs on a disk when there is already a btrfs).
Implementing it might become complicated in practice. (I have new harddisks in mind that might have ex factory a somewhat hidden special partition which must not be wiped or something like this - isn't there something like this for UEFI boot, see http://en.wikipedia.org/wiki/EFI_System_partition ).
A starting point could be "wipefs" a tool that wipes filesystem signatures from a device, see
http://karelzak.blogspot.de/2009/11/wipefs8.html
Regardless how complicated it is in practice, one dedicated function that cleans up the disk before anything else is done makes it much cleaner how rear works (instead of various workarounds here and there as needed).
The text was updated successfully, but these errors were encountered: