LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   LVM snapshots in a file instead of wasting pre allocated space? (https://www.linuxquestions.org/questions/linux-general-1/lvm-snapshots-in-a-file-instead-of-wasting-pre-allocated-space-933640/)

browny_amiga 03-09-2012 02:18 PM

LVM snapshots in a file instead of wasting pre allocated space?
 
Hi,

I am just fiddling around with LVM and snapshots and was wondering if there is a way to use snapshots without wasting a lot of space.

Normally, when you do a snapshot, the size you allocate for the snapshot must be free in the volume group. So if your snapshot will take 10% of your volume, you have to keep 10% reserved in the VG and this will be wasted and never be used for anything else than snapshots. Since I will not be using snapshots that much, I prefer to have a solution that is dynamical, i.e. that the snapshot space is a file that can grow and shrink. Currently, it seems that snapshots are similar allocated (and have to be space reserved for it rigidly, when you create the filesystem) like the swap space: you cannot use it for anything else. But with the difference, that swap space you might need every day, while snapshots you might only use from time to time.
Resizing the filesystem and logical volume is not an option, as so far I have found, reduction of the FS does not work online and you have to shut down the server every time you do it, which is unfeasable.

Can a LVM snapshot be put in a file and dynamically grow and take up as much space as it needs? In Windows I have noticed that you don't seem to have to plan for how large the snapshots become when you install the system /setup the filesystem, as it is dynamically taken from the FS.

Cheers

Markus

syg00 03-10-2012 06:47 AM

Use btrfs instead of LVM.

browny_amiga 03-14-2012 03:50 PM

Quote:

Originally Posted by syg00 (Post 4623337)
Use btrfs instead of LVM.

That does not seem good advice at this point:

http://www.h-online.com/open/news/it...l-1471706.html

quote:
----
Oracle the second Linux distributor to officially support Btrfs in an enterprise distribution, even though the filesystem is currently still considered experimental in the Linux kernel that is maintained by Linus Torvalds
...
In Fedora, OpenSUSE and Ubuntu, Btrfs has been available during installation for some time. However, plans to use Btrfs as the default filesystem have repeatedly been postponed; one of the reasons is that only a rudimentary tool for testing and repairing Btrfs filesystems is available. Like SUSE, Oracle's distribution includes an improved variant of the btrfsfsck program that hasn't become available separately. The code for an improved test and repair tool has been available in the developer repository for Btrfs tools for a month – but it is located in a branch whose name, "dangerdonteveruse", clearly advises against its use.

----

Not something that I want to trust with my valuable data. Not having a basic maintenance tool is a nono for me. It is like getting a new car and well, having no wrench (yet) available to open the hood to check the oil, coolant and belts.
But the premise of BTRFS is good, I just hope it will be ready this century still, it has been an a quasi beta state for a long time.

browny_amiga 03-14-2012 03:51 PM

But I was also not asking the question "what alternatives are there to LVM?" but more specific "how to do this with LVM?"

Markus

syg00 03-14-2012 05:27 PM

And I answered it.

browny_amiga 03-28-2012 04:50 PM

Quote:

Originally Posted by syg00 (Post 4626906)
And I answered it.

I disagree. You did not answer my original question, you side stepped it by talking about some other technology. At this point, LVM is the only viable option for me and my question was how to do it with that. It is a little like asking "how do I raise the horse power of my Ford xzy" and somebody answers "buy a Ferrari".

browny_amiga 03-28-2012 05:01 PM

To help others, this might be relevant:

http://glandium.org/blog/?p=2059

here a few excepts:
----
...Debian Squeeze + btrfs = FAIL
...Lesson learned:
Never use a file system without a working fsck in production...
----

Like me he is using RAID and Debian Squeeze and is looking for a fs that can do snapshotting.
So it seems to be still a work in progress, beta stage.

Not that great for a filesystem, as consistent and reliable operation is unfortunately not an option at such an essential layer of the OS.


All times are GMT -5. The time now is 11:27 PM.