Comment 1 for bug 116633

Revision history for this message
Michael Vogt (mvo) wrote :

Here is a small patch to add a check for this to luksformat:

diff -u cryptsetup-1.0.4+svn29/debian/scripts/luksformat cryptsetup-1.0.4+svn29/debian/scripts/luksformat
--- cryptsetup-1.0.4+svn29/debian/scripts/luksformat
+++ cryptsetup-1.0.4+svn29/debian/scripts/luksformat
@@ -29,6 +29,14 @@

 $device = $ARGV[0];

+open(MOUNTS, "/proc/mounts");
+foreach $line (<MOUNTS>) {
+ if ($line =~ $device) {
+ print STDERR "Error: device mounted: $device\n";
+ exit 1;
+ }
+}
+
 $mkfs = "/sbin/mkfs.$fs";
 if (! -x $mkfs) {
     print STDERR "Error: invalid file system: $fs\n";