While diffing mounted snapshots would work, it sounds like it could be horribly slow in many cases.
Is there btrfs specific functionality for diffing snapshots? (I was unable to find any in the docs)
While diffing mounted snapshots would work, it sounds like it could be horribly slow in many cases.
Is there btrfs specific functionality for diffing snapshots? (I was unable to find any in the docs)
We are looking into using BtrFS on an array of SSD disks and I have been asked to verify that BtrFS does in fact perform TRIM operations upon deleting a file. So far I have been unable to verify that the TRIM command is sent to the disks.
I know BtrFS is not considered production ready, but we like the bleeding edge, therefore I'm testing it. The server is Ubuntu 11.04 server 64-bit release (mkfs.btrfs version 0.19). I have installed the Linux 3.0.0 kernel as the BtrFS changelog states that bulk TRIM is not available in the kernel shipped with Ubuntu 11.04 (2.6.38).
Here's my testing methodology (initially adopted from http://andyduffell.com/techblog/?p=852, with modifications to work with BtrFS):
for i in {0..10} ; do let A="$i * 65536" ; hdparm --trim-sector-ranges $A:65535 --please-destroy-my-drive /dev/sda ; done
./sectors.pl |grep + | tee sectors-$(date +%s)
fdisk /dev/sda
mkfs.btrfs /dev/sda1
sudo mount -t btrfs -o ssd /dev/sda1 /mnt
dd if=/dev/urandom of=/mnt/testfile bs=1k count=50000 oflag=direct
./sectors.pl | tee sectors-$(date +%s)
rm /mnt/testfile
./sectors.pl | tee sectors-$(date +%s)
diff
the two most recent sectors-*
filesAt this point, the pre-delete and post delete verifications still show the same disk blocks in use. I should instead see a reduction in the number of in use blocks. Waiting an hour (in case it takes a while for the TRIM command to be issued) after the test file is deleted still shows the same blocks in use.
I have also tried mounting with the -o ssd,discard
options, but that doesn't seem to help at all.
Partition that was created from fdisk
above (I keep the partition small so the verification can go faster):
root@ubuntu:~# fdisk -l -u /dev/sda
Disk /dev/sda: 512.1 GB, 512110190592 bytes
255 heads, 63 sectors/track, 62260 cylinders, total 1000215216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6bb7542b
Device Boot Start End Blocks Id System
/dev/sda1 63 546209 273073+ 83 Linux
My sectors.pl
script (I know this is inefficient, but it gets the job done):
#!/usr/bin/perl -w
use strict;
my $device = '/dev/sda';
my $start = 0;
my $limit = 655360;
foreach ($start..$limit) {
printf "\n%6d ", $_ if !($_ % 50);
my @sector = `/sbin/hdparm --read-sector $_ $device`;
my $status = '.';
foreach my $line (@sector) {
chomp $line;
next if $line eq '';
next if $line =~ /$device/;
next if $line =~ /^reading sector/;
if ($line !~ /0000 0000 0000 0000 0000 0000 0000 0000/) {
$status = '+';
}
}
print $status;
}
print "\n";
Is my testing methodology flawed? Am I missing something here?
Thanks for the help.
As far as I know, LVM makes it possible to take snapshots of a volume. There are also a number of file systems (ZFS, Btrfs, reiserfs, ...) which supports snapshots.
However, I've never understood the difference between LVM snapshots and file system snapshots. If it's possible to take snapshots with LVM, why does someone take their time to implement it in a file system?
Edit: Is any of them preferred in some situations? Why?
I have an existing BTRFS filesystem composed of one 500GB disk and I just bought a 2TB disk to increase the storage capacity of my home server and I want add the new disk to the existing filesystem. From what I read, it seems like no BTRFS setup can handle disk of different sizes without wasting the difference in size between the larger and the smaller disk, but I'm new to BTRFS and I might have missed something, so is there a setup that can allow me to combine two disks in a filesystem without wasting space ?