Showing posts with label block. Show all posts
Showing posts with label block. Show all posts

Tuesday, 11 July 2017

Creating Virtual Block Devices

Creating Virtual Block Devices


When playing with filesystems or setting up virtual machines, you may want to create virtual block devices (files that act similar to hard drives). Here I will explain the two ways to create such devices and the pros/cons of each

Normal Way

This is the normal way to create a block device and will create an 8 GiB pre-allocated device:
dd if=/dev/zero of=/path/to/dir/filename.img bs=1M count=8192
You may want to change the block size (bs), and change the count in order to change the capacity of the device.
The count x bs = capacity, so reducing the block size would reduce your capacity if you did not adjust the count accordingly.

Advantages

  • Better performance than with the "sparse" method
  • Cant run out of space before the underlying device is full (dedicated).

Disadvantages

  • This eats up your disk capacity very quickly. E.g. your disk is "full" after creating lots of these empty devices, and the majority of them may never reach half capacity.
  • Slow to create (has to write the capacitys worth in 0s to the physical drive)

Sparse Image

Create a "sparse" image with the following example command which creates a 100GB device
dd if=/dev/zero of=/path/to/dir/filename.img bs=1k count=1 seek=100M
The 100M is NOT meant to be 100GB
Running an ls -alh will clearly show the file as being 100G in size, but running a df -h on / shows that it is not used.

Advantages

  • Almost instantaneous creation
  • Only data written to the image actually takes up space on your physical drive. Thus, you can oversell your physical drive.

Disadvantages

  • Poorer performance when writing to.
  • May not be able to write to the device before its capacity is reached because the underlying device has been filled.
{ Read More }


Monday, 17 April 2017

Create AdBlock custom filters and block rules

Create AdBlock custom filters and block rules


AdBlock+

Even though is a little complicated than Firefox, you can block custom items in AdBlock for Chrome too. It�s just like this.

Click on the AdBlock button > Block element.

AdBlock

A message will appear, read it, and then click on the ad or element of the website that you want blocked. In this case, the ads on Facebook�s right bar.

AdBlock+

When you click an element, all other elements with the same value will be selected too. Also, you�ll see a screen letting you know the address or rule that will be used to the element.

AdBlock+

Now just click the Add button and reload the site.

AdBlock+

{ Read More }