You are not logged in.

#1 2013-06-22 19:01:37

Registered: 2013-06-22
Posts: 1

Wipe free space on LVM on LUKS volume

My three partitions for my system are created with LVM on a LUKS partition (dm-crypt). These are /home, / and  swap. The filesystem is ext4.
They are encrypted, because they are on my laptop and I don't want that some laptop thieves get my data.
But I often share my laptop with other people so they can access my encrypted partitions. I don't want that these people can recover my cache and all the data I deleted.

So I'm now trying to wipe all my free space on /home to prevent against recovering with tools like photorec. (one overwrite should do, the need of multiple overwriting is just a rumor)
But still I haven't found any solution to wipe this free space successfully.
I tried dd if=/dev/zero of=/home/fillitup bs=512 count=[count of free sectiors] so my partition was complete full of data.
df /dev/mapper/home said 100% is used and there are 0 sectors available. But I could still recover gigs of data with photorec, although I selected to recover just form the free space.
photorec displays: /dev/mapper/home - 340 GB / 317 GiB (RO) , but df displays that the size of /home is just 313G, why are there these differences and what did the 340GB means?

It looks like there is a place on my /dev/mapper/home partition, that I can't access to overwrite, but I can access it to recover. I also checked for corrupted sectors, but there aren't any.

Did anyone knows why I can't wipe my free space with dd, and how I can find the location of the loads of recoverable files, to securely delete them?


#2 2013-06-23 17:28:02

Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Wipe free space on LVM on LUKS volume

Try using dd as root or disable the space reserved for root with tune2fs and use dd as a normal user.



#3 2013-06-26 06:42:34

Registered: 2012-08-15
Posts: 88

Re: Wipe free space on LVM on LUKS volume

Well if you have the space, you can just move everything to a different drive, wipe the drive, and move everything back. Tar is good for this purpose but it's not foolproof.

That doesn't really answer your specific question though. As for how to get that done, I'm not sure except by using shred instead of rm to delete things in the future (which is itself not always perfect)


#4 2013-07-07 09:05:24

From: Italia
Registered: 2007-02-16
Posts: 118

Re: Wipe free space on LVM on LUKS volume

Or use scrub, from his man (

-X, --freespace
Create specified directory and fill it with files until write returns ENOSPC (file system full), then scrub the files as usual. The size of each file can be set with -s, otherwise it will be the maximum file size creatable given the user's file size limit or 1g if umlimited.

and it supports different patterns:

-p, --pattern nnsa|dod|bsi|old|fastold|gutmann|random|random2
Select the patterns to write. nnsa selects patterns compliant with NNSA Policy Letter NAP-14.x; dod selects patterns compliant with DoD 5220.22-M; bsi selects patterns recommended by the German Center of Security in Information Technologies (; old selects pre-version 1.7 scrub patterns; and fastold is old without the random pass. gutmann is a 35-pass sequence described in Gutmann's paper cited below. See STANDARDS below for more detail. random is a single random pass. random2 is two random passes. Default: nnsa.

Hope it'll help smile


#5 2013-07-07 09:12:54

From: Bielefeld, Germany
Registered: 2013-06-24
Posts: 49

Re: Wipe free space on LVM on LUKS volume

Not sure about dd, but I have used wipe to scrub a partition, worked quite well. I think it was as simple as

wipe -k /dev/sdX1


Board footer

Powered by FluxBB