Groups | Search | Server Info | Login | Register
Groups > alt.os.linux.ubuntu > #212498
| From | Josef Möllers <josef@invalid.invalid> |
|---|---|
| Newsgroups | alt.os.linux.ubuntu |
| Subject | Re: Zerofree won't run with LiveCD |
| Date | 2026-03-31 14:38 +0200 |
| Message-ID | <n31tigFbpg8U1@mid.individual.net> (permalink) |
| References | <10qenet$2pmir$1@dont-email.me> <10qf3r5$2u1jp$1@dont-email.me> <10qg0uu$362r5$1@dont-email.me> |
On 31.03.26 10:34, George Garth wrote:
> On 3/30/26 8:17 PM, Paul wrote:
>> On Mon, 3/30/2026 4:46 PM, George Garth wrote:
>>> One of my other tasks, aside from the cleansing of Win drives using
>>> Sdelete and other tools, was to also cleanse the free space of Ubuntu
>>> partitions.
>>>
>>> A prior post mentioned the use of Zerofree, but it has to be done on
>>> unmounted partitions. Today, I brought out an old LiveDVD with 16.04
>>> on it then installed Zerofree via apt. I then listed the partitions
>>> and found the one I needed, /dev/sdb2, but trying to run sudo
>>> zerofree /dev/sdb2, I get the following error: failed to open file
>>> system: /dev/sdb2. I then tried to create a mount point (mkdir: /
>>> mnt/temp) and then mounted /dev/sdb2 onto that point, but a new error
>>> about something not in GRUB.
>>>
>>> Suggestions welcome for getting this up and running and thanks in
>>> advance.
>>
>> My notes file says:
>>
>> sudo zerofree -v /dev/sdb1 # fill with zeros, before compaction in host
>> # /dev/sdb1 should not be mounted when
>> you run it
>>
>> *******
>>
>> Do a "df" or a "cat /etc/mtab" and check what is mounted, as
>> /dev/sdb1 should not be mounted for the example to work.
>>
>> *******
>>
>> https://manpages.ubuntu.com/manpages/focal/man8/zerofree.8.html
>>
>> zerofree - zero free blocks from ext2, ext3 and ext4 file-systems
>>
>> -n Perform a dry run (do not modify the file-system);
>>
>> -v Be verbose: show the number of blocks modified by
>> zerofree (or that would be modified, in case
>> the -n is used), the number of free blocks and the
>> total number of blocks on the filesystem;
>>
>> -f value Specify the octet value to fill empty blocks with
>> (defaults to 0). Argument must be within the
>> range 0 to 255.
>>
>> Paul
>
> Ok, well, I finally got it to run.... sort of. I'll try to explain. I'm
> not all that well versed in Linux particulars other than plug and play,
> but here goes....
>
> Booted into Ubuntu from a USB for a session. Did a "df" as suggested to
> find:
>
> https://imgur.com/a/1RR4Yna
>
> Unmount /dev/sda2 to be sure and then tried to run Zerofree:
>
> https://imgur.com/a/IkkZCWb
>
>
> The only way I could get Zerofree to run was to do:
>
> sudo zerofree -v /dev/sda8 and then the same except for sda7.
>
> Tried the swap as well but to no avail:
>
> https://imgur.com/a/r6eaAoT
>
>
> So, my guess is that the program is not recognizing the extended sda2
> for some reason. I'm going to assume that since I was able to use it on
> sda7 & 8, I should be ok, but why not working for the swap?
First of all: access to the (raw) disks is allowed to the administrator
(called "root" in Linux) ONLY. Otherwise anybody could get around the
protection mechanisms the file systems provide (*). So running
"zerofree" with "sudo" (run the command as "root") is correct.
Re /dev/sda2: According to the first screen shot, "sda2" is the extended
partition and, as such, does not by itself hold a file system. Instead
it holds "logical partitions" which tehn can hold file systems.
Since the only two partitions that hold anything that looks like Linux
file systems are "sda7" and "sda8", these two are the only partitions
that you can run "zerofree" on.
"sda5" is a (Linux) swap-partition and does not hold a file system, so
you cannot fill any free space with zeroes. Thus said, if you run off a
USB stick and you reallyreally want to also wipe the swap partition,
then you could wipe the entire swap partition using "sudo dd
if=/dev/zero of=/dev/sda5 bs=128k" and wait until that is done, this
might just take some time.
IMPORTANT NOTE: CHECK THE COMMAND LINE SEVERAL TIMES TO MAKE SURE YOU
ACTUALLY SPECIFY THE SWAP PARTITION!!!! MAYBE ASK SOMEONE ELSE TO CHECK
AS WELL.
Also check if the system you run off the stick is not using the swap
partition by running "cat /proc/swaps" (no "sudo" required, checking
what is used as swap is not anything privileged) and check if
"/dev/sda5" is not mentioned. If it is, run "sudo swapoff /dev/sda5" to
turn that off.
Hope this helps,
Josef
(*) When studying CS in the late 70s, one of the tasks in "Operating
Systems" was to inspect the file system structure and dump the block
addresses of a given disk file. To do that, "/dev/sda" and "/dev/sdb"
were both readable by anybody ("world readable"). It was just a small
step to the dump the contents of those blocks and thus access files that
were not readable by anybody but the owner of the file ;-)
Back to alt.os.linux.ubuntu | Previous | Next — Previous in thread | Next in thread | Find similar
Zerofree won't run with LiveCD George Garth <none@nowhere.com> - 2026-03-30 16:46 -0400
Re: Zerofree won't run with LiveCD Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-03-30 23:48 +0000
Re: Zerofree won't run with LiveCD Paul <nospam@needed.invalid> - 2026-03-30 20:17 -0400
Re: Zerofree won't run with LiveCD George Garth <none@nowhere.com> - 2026-03-31 04:34 -0400
Re: Zerofree won't run with LiveCD Mike Scott <usenet.16@scottsonline.org.uk.invalid> - 2026-03-31 12:14 +0100
Re: Zerofree won't run with LiveCD Paul <nospam@needed.invalid> - 2026-03-31 07:52 -0400
Re: Zerofree won't run with LiveCD George Garth <none@nowhere.com> - 2026-03-31 08:12 -0400
Re: Zerofree won't run with LiveCD Jeff Layman <Jeff@invalid.invalid> - 2026-03-31 16:30 +0100
Re: Zerofree won't run with LiveCD Josef Möllers <josef@invalid.invalid> - 2026-03-31 14:38 +0200
Re: Zerofree won't run with LiveCD George Garth <none@nowhere.com> - 2026-03-31 08:51 -0400
Re: Zerofree won't run with LiveCD Paul <nospam@needed.invalid> - 2026-03-31 09:07 -0400
Re: Zerofree won't run with LiveCD George Garth <none@nowhere.com> - 2026-03-31 10:52 -0400
Re: Zerofree won't run with LiveCD Paul <nospam@needed.invalid> - 2026-03-31 16:17 -0400
Re: Zerofree won't run with LiveCD Gordon <Gordon@leaf.net.nz> - 2026-04-01 03:50 +0000
Keeping notes (was Re: Zerofree won't run with LiveCD) Josef Möllers <josef@invalid.invalid> - 2026-04-01 14:51 +0200
Re: Keeping notes (was Re: Zerofree won't run with LiveCD) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-04-01 20:42 +0000
Re: Keeping notes (was Re: Zerofree won't run with LiveCD) Josef Möllers <josef@invalid.invalid> - 2026-04-03 11:28 +0200
Re: Zerofree won't run with LiveCD Paul <nospam@needed.invalid> - 2026-05-06 02:08 -0400
csiph-web