Even though I like ZFS, I am using Linux which has not yet good ZFS-Support, and LUKS. Using LUKS with an encrypted swap I want to be able to use for suspending, still the easiest possibility to achieve this is using an LVM [yes, this sentence is gramatically correct ...].
However, so far I only used this on one partition, which is already very flexible. Today I tried to use LVM on three USB-Sticks that I found occasionally. As they have different sizes, there is no point in creating a Raid, so I just used them directly.
So, I have three USB-Sticks, of different size, /dev/sdb, /dev/sdc, /dev/sdd. Firstly, I create the physical volumes on them:
root@thinkpad:/# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created root@thinkpad:/# pvcreate /dev/sdc Physical volume "/dev/sdc" successfully created root@thinkpad:/# pvcreate /dev/sdd Physical volume "/dev/sdd" successfully created
Then I create the volume group:
root@thinkpad:/# vgcreate vgusb1 /dev/sdb /dev/sdc /dev/sdd Volume group "vgusb1" successfully created
(Actually, a lot of rw-errors are emitted, but they are pointless, and I left them out, and I will leave them out in the further commands.)
Then I create a logical volume, with 40% of the size of the whole volume group:
# lvcreate -l 40%FREE -n test vgusb1 Logical volume "test" created
Let us make an ext4 filesystem on it:
root@thinkpad:/# mkfs.ext4 /dev/vgusb1/test mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 64512 inodes, 258048 blocks 12902 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=264241152 8 block groups 32768 blocks per group, 32768 fragments per group 8064 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376
This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. root@thinkpad:/# mount /dev/vgusb1/test /mnt
So, now I have the filesystem. Lets create a file with random content:
Snapshotting apparently worked. Apparently, it still works, when I unplug the sticks and plug them in again in a different order, and they get different devicenames.