Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 17287
Next
In Process

askthedev.com Latest Questions

Asked: September 27, 20242024-09-27T13:59:49+05:30 2024-09-27T13:59:49+05:30In: Ubuntu

How can I use zerofree on Ubuntu 18.04 to reclaim free space on my disk?

anonymous user

I’ve been trying to figure out how to reclaim some free space on my Ubuntu 18.04 system, and I stumbled across this tool called “zerofree.” Honestly, I’m a bit confused about how exactly to use it effectively. I know it’s supposed to help with deleting empty blocks on a filesystem so that I can actually recover that space, but I’m a little lost on where to start.

So here’s my situation: I’ve been running my Ubuntu for a while, and I like to keep everything organized, but I keep hitting this wall of running low on disk space. I’ve done some cleaning—like removing old packages and clearing out cache—but I still feel like there’s a bunch of space just sitting there uselessly because it’s “free” but not actually available for new files. I heard that zerofree can help clear that up, but I’m not too sure about the specifics.

I’ve read that you need to use it on unmounted filesystems or something like that, which freaked me out a bit. I can’t afford to turn off my computer for long since I’m constantly using it for work, so how can I even manage that? Do I need to boot from a live USB to use it? And what about the potential risks? I mean, I really don’t want to mess anything up—my files are important to me!

Also, after I run zerofree, is there some sort of additional step I should take to make sure the free space is actually reclaimed? Like running fstrim or something? I’ve heard some things about that, but I’m not quite sure when and how to implement it after zerofree.

If anyone has gone through this process or can share some straightforward steps (maybe even some dos and don’ts?), I would really appreciate it. It’s a bit overwhelming, and I want to make sure I’m doing it right without ending up with a messed-up system. Thanks!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2024-09-27T13:59:50+05:30Added an answer on September 27, 2024 at 1:59 pm






      Using Zerofree on Ubuntu 18.04

      Using Zerofree to Reclaim Space on Ubuntu 18.04

      So you want to free up some disk space using zerofree? No worries, I’ll help break it down for you!

      What is Zerofree?

      Zerofree is a tool that helps clear out empty blocks on a filesystem. This can be helpful if you have a lot of deleted files that aren’t completely removed, making it seem like you’re running out of space.

      Before You Start: Backup!

      First things first—make sure you back up your important files! Just in case something goes wrong, you’ll want to be safe.

      Using Zerofree

      1. Unmount the filesystem: You can’t run zerofree on a mounted filesystem, which means you’ll need to boot from a Live USB to access it. This might seem daunting, but it’s pretty easy!
      2. Create a Live USB: Download an Ubuntu ISO and use software like Rufus (for Windows) or the Startup Disk Creator on Ubuntu to create a bootable USB.
      3. Boot from the Live USB: Restart your computer and boot from the USB. You may need to change your boot order in BIOS/UEFI.
      4. Run Zerofree:

        sudo zerofree /dev/sdXY

        Make sure to replace /dev/sdXY with your actual unmounted partition (like /dev/sda1).

      Post-Zerofree Steps

      Once you’re done with zerofree, you may want to run fstrim to help the system recognize the newly freed space:

      sudo fstrim /dev/sdXY

      Do’s and Don’ts

      • Do: Backup your important data!
      • Do: Make sure to unmount the filesystem before running zerofree.
      • Don’t: Run zerofree on a mounted filesystem—it could mess things up!
      • Don’t: Panic! Follow the steps and you’ll do great!

      Risks

      As with any filesystem operation, there’s a small risk involved, especially when messing around with partitions. Just make sure your backups are in place, and you should be fine!

      Hopefully, this helps clarify how to use zerofree without freaking out too much. Good luck with reclaiming that space!


        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2024-09-27T13:59:50+05:30Added an answer on September 27, 2024 at 1:59 pm

      “`html

      Zerofree is a utility designed for reclaiming space on ext2/ext3 filesystems by identifying and clearing out empty blocks. To use it effectively in Ubuntu 18.04, you must first ensure that the filesystem you want to operate on is unmounted. This means you can’t run it on your main system drive while the system is running, which is indeed a concern for those who rely on their machines for work. A common approach is to boot from a live USB stick that has Ubuntu on it. Once you boot into the live environment, you can open a terminal and run sudo zerofree /dev/sdX, replacing /dev/sdX with the appropriate partition (like /dev/sda1 for your root filesystem). Before doing any of this, it’s essential to back up your data to avoid any unintended loss, especially if you’re not familiar with command-line operations.

      After running zerofree, the next step to ensure the reclaimed space is recognized is to invoke the fstrim command, which is particularly useful for SSDs. You can run sudo fstrim /mount/point to discard any blocks that are not filled. Just ensure the relevant filesystem is correctly mounted again if you had previously unmounted it. It’s wise to read through the manual pages for both zerofree and fstrim (man zerofree and man fstrim) for detailed options and handling specifics. Do avoid running zerofree on a mounted filesystem, as this can lead to data corruption, and take care when specifying device names to prevent running commands on the wrong partition. Always ensure your critical files are backed up before proceeding with operations that modify disk structures.

      “`

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this issue?
    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?
    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. Has anyone experienced this issue ...
    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?
    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else encountered this problem, and what ...

    Sidebar

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this ...

    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?

    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. ...

    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?

    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else ...

    • How can I configure a server running Ubuntu to bind specific IP addresses to two different network interfaces? I'm looking for guidance on how to ...

    • Is it possible to configure automatic login on Ubuntu MATE 24.04?

    • After upgrading from Ubuntu Studio 22.04 to 24.04.1, I lost all audio functionality. What steps can I take to diagnose and resolve this issue?

    • I am experiencing issues booting Ubuntu 22.04 LTS from a live USB. Despite following the usual procedures, the system fails to start. What steps can ...

    • I'm encountering a problem with my Expandrive key while trying to update my Ubuntu system. Has anyone else faced similar issues, and if so, what ...

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.