DM-Devel Archive mirror
 help / color / mirror / Atom feed
From: Michael DiDomenico <mdidomenico4@gmail.com>
To: dm-devel@lists.linux.dev
Subject: delete on snapshot does not free space
Date: Tue, 30 Apr 2024 13:54:39 -0400	[thread overview]
Message-ID: <CABOsP2PL9AM5phv4ZhucGmpk6V1x+DozXLaPTBVaWqMdy-KdPA@mail.gmail.com> (raw)

this is probably expected behavior, but i'd like to confirm as i'm not
a device-mapper expert

we're using COW snapshots overtop of a readonly block device.  this
seems to be working fine, however, when a person deletes files the
blocks are not freed.  case in point a RO block device with a COW
filled up to 100% as shown in df.  when i deleted some files to free
space the usage never decreased

to create the mount we do

echo "0 <realsize> linear /dev/loop1 0" | dmsetup create roimage-base-real
echo "0 <cowsize> linear /dev/loop2 0" | dmsetup create roimage-snap-cow
echo "0 <realsize> snapshot-origin /dev/mapper/roimage-base-real" |
dmsetup create roimage-base
echo "0 <realsize> snapshot /dev/mapper/roimage-base-real
/dev/mapper/roimage-snap-cow n 1" | dmsetup create roimage-cow

mount /dev/mapper/roimage-cow /roimagemntpnt

this is working as the origin device is Read-Only, but we can change files.

so two questions come up

1 when we delete files, how do we reclaim the space
2 should/can we roll the snapshots to reclaim space?
- if i wanted to create a new snapshot and discard the existing one,
do i basically just to the fourth step again to a different device?  i
haven't found a "clear" how-to on this.  most people just stop after
the fourth line and then tear it all down

ideally what i'm looking to do is create a filesystem where the base
is read-only, but we can make changes.  i'm okay with all those
changes getting lost after a reboot/unmount/etc.  the issue right now
is when df shows 100% usage it seems the only recourse is reboot(aka
clear it all out) and restart.  i'm hoping there's something more
graceful

             reply	other threads:[~2024-04-30 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 17:54 Michael DiDomenico [this message]
2024-04-30 20:35 ` delete on snapshot does not free space Zdenek Kabelac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABOsP2PL9AM5phv4ZhucGmpk6V1x+DozXLaPTBVaWqMdy-KdPA@mail.gmail.com \
    --to=mdidomenico4@gmail.com \
    --cc=dm-devel@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).