Rich Freeman on 12 Jul 2012 10:32:01 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] SteadyState/DriveShield for Ubuntu?

On Thu, Jul 12, 2012 at 11:32 AM, Jack Hill <> wrote:
> But you don’t need to. Suppose you have the LV home on VG vg0. When
> a user logs in you
> lvcreate -n home-temp -s home -L some-reasonable-size
> mount /dev/vg0/home-temp /home
> All the change the user makes get copy-on-written by disk block changed
> to home-temp. When the user logs out simply
> lvremove /dev/vg0/home-temp.

I'm pretty sure you have that backwards.  When you have an LVM
snapshot for a volume, and you write to that volume, the change gets
written to the original volume, and the original value of those blocks
are written to the snapshot.  When you delete the snapshot you're
deleting the ORIGINAL content of the volume, and not the changes.

This is the opposite of something like VMWare where the snapshot
contains the changes.  That's why deleting a snapshot in LVM takes
almost no time, but removing it in VMWare takes a long time (since the
changes have to be merged in to the original).

With Btrfs every block on the disk is COW, so a snapshot just means
that anytime a block is modified you end up with two copies of it, and
a completely intact inode tree that points to each one (one tree looks
like a drive in the current state, and one tree looks like the drive
in the original state).  When you remove a snapshot it just wipes out
the root of the tree and anything whose reference count drops to zero
(like unlinking a file on EFS), so removing either the snapshot or the
original is fast, and both are equivalent operations (other than maybe
one tree having a numeric ID of 1 all the snapshots and the original
root are equivalent in btrfs).

The btrfs/ZFS model is conceptually pretty similar to git if you know
how that works.  But, git doesn't really make provisions for deleting
history (think of git like a filesystem that snapshots anytime you
change anything and the snapshots never go away, but form a linked

> A more robust solution might be to run user sessions in a
> VM.

Assuming Ubuntu doesn't already have a clean solution for this, Google
has a few.  The simplest is to just keep a copy of the home directory
and wipe it every time X11 exits.  Just make a shell script that wipes
the user directory and makes a fresh copy, drops privs, starts X11,
and then terminates.  Then just stuck it in inittab.

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --