Sonntag, August 24, 2014

start Btrfs with one disk and add second for RAID1 setup

The new file server will contain two 4TB disks as RAID1 and a single 4TB disk for of side backup. All three disks are different to spread the risk of failing at the same time. The RAID disks will be a WD red and a Segate NAS. The backup disk a WD green. Unfortunately the Segate was out of stock.

To test how simple it is to start with only one RAID disk I added two disk to a VM and did all needed steps there. From the starting point off the simple creation to starting the RAID.

To verify this, I created some files on the first disk and compared the hash of the files after the test.

1. create the file system with one disk

[root@centos ~]# mkfs.btrfs -L test_merge_HDs /dev/sdb
SMALL VOLUME: forcing mixed metadata/data groups

WARNING! - Btrfs v3.12 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

Turning ON incompat feature 'mixed-bg': mixed data and metadata block groups
Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
Created a data/metadata chunk of size 8388608
fs created label test_merge_HDs on /dev/sdb
nodesize 4096 leafsize 4096 sectorsize 4096 size 500.00MiB
Btrfs v3.12

[root@centos /]# btrfs fi df /mnt/merge/
System, single: total=4.00MiB, used=4.00KiB
Data+Metadata, single: total=8.00MiB, used=28.00KiB

[root@centos /]# btrfs fi show 
Label: test_merge_HDs  uuid: b5aa052e-b44c-4e80-8e2b-3b7d04eb19e4
Total devices 1 FS bytes used 32.00KiB
devid    1 size 500.00MiB used 12.00MiB path /dev/sdb

Btrfs v3.12

2. add the second disk

[root@centos /]# btrfs device add /dev/sdc /mnt/merge/
SMALL VOLUME: forcing mixed metadata/data groups

[root@centos /]# btrfs fi df /mnt/merge/
System, single: total=4.00MiB, used=4.00KiB
Data+Metadata, single: total=8.00MiB, used=28.00KiB

[root@centos /]# btrfs fi show 
Label: test_merge_HDs  uuid: b5aa052e-b44c-4e80-8e2b-3b7d04eb19e4
Total devices 2 FS bytes used 32.00KiB
devid    1 size 500.00MiB used 12.00MiB path /dev/sdb
devid    2 size 500.00MiB used 0.00 path /dev/sdc

Btrfs v3.12

3. start the RAID

[root@centos /]# btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/merge/
Done, had to relocate 2 out of 2 chunks

[root@centos /]# btrfs fi df /mnt/merge/
System, RAID1: total=32.00MiB, used=4.00KiB
Data+Metadata, RAID1: total=112.00MiB, used=100.00KiB

[root@centos /]# btrfs fi show 
Label: test_merge_HDs  uuid: b5aa052e-b44c-4e80-8e2b-3b7d04eb19e4
Total devices 2 FS bytes used 104.00KiB
devid    1 size 500.00MiB used 144.00MiB path /dev/sdb
devid    2 size 500.00MiB used 144.00MiB path /dev/sdc

Btrfs v3.12



new file server with Btrfs

It's time to update my file server. The last time I decided to use a modern file filesystem - ZFS. As there was no real Linux support I played with it on FreeBSD. But the best support at the time was in Sun's Solaris of corse. As I didn't know both system very well I choose OpenSolaris. Unfortunately this was one of the looser of the Sun acquisition.

The next time, I decided, every thing should be better. Lets see.

My knowledge of BSD isn't better as five years ago. Therefore my first decision is to stick with what I know - Linux. As the ZFS support is not really better I will use the Linux version of the modern filesystem - Btrfs. It is still marked as unstable, but some Linux distribution, including Oracle, changed the status from experimental to production. And in my case, where I use basic features only, there shouldn't be any problem.

As a Linux distribution I choose CentOS over Debian.  The long term support is better (longer) and I administrated RHEL machines at work for around 3 years. And as a desktop system I use Fedora for quite some time and impressed me with the SELinux integration. Therefore I don't expect any surprises.

Samstag, August 23, 2014

show open iCloud Tabs in shell

I've got the idea from this macstories post. In the attached Python script you find not only the location where the OS keeps the information. But also how to access it.

After I had a look at the man page for plutil I started my own test.
plutil -p ~/Library/SyncedPreferences/com.apple.Safari.plist
This will display the informatio in a JSON looking format.
plutil -convert xml1 -o /tmp/iCloudTabs2.xml  ~/Library/SyncedPreferences/com.apple.Safari.plist
Converts the information to XML. Don't miss the -o or it will overwrite the original file. Instead you could also use -e xml to write to a file with the new extension.

The output contains the device, URL, page title and more. If I find some information on the iPad and want to save, I keep the tap open. The next time at the Mac the URL to download this with curl or wget is already there.

Freitag, August 22, 2014

don't use "Inspect Element" to design filter rules

Never use your browsers Inspect Element to look at the HTML and expect it to be like this in the transmitted file!

I tried to use this to design a filter for Privoxy to remove a . The browser showed me the line as
But even
s///Usig
didn't remove any of the links. And I gave up.

Only after I was working at an other filter and using View Source to look a the HTM code I realised the difference. For Inspect Element the browser will use it's internal representation. And this results not only in the use of end tags, but also a different order of attributes.

A look at the actual source showed that the line in question actually looked like this
Now I was able to design the filter like this
s///Us
to remove the line.

Sonntag, Mai 11, 2014

running linux server headless in VirtualBox

For tests I use a simple arch linux installation with out X installed. This saves quite some RAM. But I had still the Window of the VM, that I was not using. Instead I used multiple ssh logins with different sized terminal windows.

There should be a way to run the VM headless, like the real server. A search brought me to this description on running a VirtualBox headless and using a RDP or SSH connection.

For me this boils down to:

  1. list the available VMs: VBoxManage list vms
  2. start the VM: VBoxManage startvm arch --type headless
  3. connect as usual: ssh user@address
  4. and switch off the VM after a shutdown: VBoxManage controlvm arch poweroff