space


Extend LVM space to the rest of the free space on the disk

Recently, we formatted a server with Ubuntu 22.04 LTS. While selecting the disk settings, we selected the encrypted LVM partition scheme, and even though we selected the whole disk, we did not notice that the LVM would only allocate, by default, 100GB out of the 600GB available on the raid volume.

So, we proceeded with the installation, and at some point, we noticed that we ran out of space which should not have happened.

Using the command df -h we quickly spotted the problem:

$ df -h
Filesystem                 Size  Used Avail Use% Mounted on
tmpfs                      3,2G  3,9M  3,2G   1% /run
/dev/mapper/vgubuntu-root  100G   83G   17G  83% /
tmpfs                       16G   40M   16G   1% /dev/shm
tmpfs                      5,0M  4,0K  5,0M   1% /run/lock
/dev/sda5                  703M  257M  395M  40% /boot
/dev/sda1                  511M   24K  511M   1% /boot/efi
tmpfs                       16G     0   16G   0% /run/qemu
tmpfs                      3,2G  156K  3,2G   1% /run/user/1000

/dev/mapper/vgubuntu-root was only 100GB instead of the 600GB that we would expect it to be.

Using the command vgdisplay we verified that the space allocated to the logical volume group was not what we wanted.

To fix the problem, we issued the following commands:

lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv;
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv;

lvextend instructed our logical volume to consume all the available space on the hosting disk.

Then resize2fs allocated all the available space to our partition.


Forcing user to remove trailing spaces in git

There are simple ways to force the user in removing trailing spaces before committing code in git using hooks.
Below we will present a solution that is applied at the local computer before the commit stage, which each developer needs to perform in each repository clone they own.
Note: If you would like to have the hooks on the server, you will need extra access rights to modify the hooks on the remote machine, maybe you will even need your systems administrator to configure it.

Solution

Attached you will find a file named pre-commit ([download id=”3933″]) it is a hook that get applied before the user is allowed to even commit.
That file you need to copy it (after you extract it) in the .git/hooks folder of your cloned repositories and you are done!

What this script does is simple, if there are whitespace errors, it prints the offending file names and fails.
What are considered whitespace errors is controlled by core.whitespace configuration.
By default, trailing whitespaces (including lines that solely consist of whitespaces) and a space character that is immediately followed by a tab character inside the initial indent of the line are considered whitespace errors.

In case you need to commit files that have whitespace errors, you can bypass the checks that are applied by the hooks using the --no-verify flag as follows:

git commit -m "Some informative message" --no-verify;

There are more ways to achieve this result, others are more verbose but this one is the simplest and more flexible as you can configure it using the git configuration variables.

[download id=”3933″]

#!/bin/sh
#
# This hook script verifies that there are no whitespace errors in the files to be committed

if git rev-parse --verify HEAD >/dev/null 2>&1
then
 against=HEAD
else
 # Initial commit: diff against an empty tree object
 against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

# Redirect output to stderr.
exec 1>&2

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

[download id=”3933″]


2GB επιπλέον χώρος στο GMail

Για να πάρετε δωρεάν 2GB επιπλέον χώρο μπείτε στον έλεγχο ασφαλείας του profile σας μέχρι τις 11 Φεβρουαρίου 2016 (αύριο) και ολοκληρώστε την διαδικασία.

Διαρκεί μόνο 2 λεπτά και 2GB επιπλέον χώρος θα γίνουν δικά σας!

Αυτή η κίνηση έγινε επ’ευκαιρίας της ημέρας ασφαλής χρήσης του διαδικτύου.


Beta test dropbox and get even more free space!

We tried this and it works!

Dropbox is now offering a way of increasing your free space by trying out an Experimental build of the application that allows your machine to scan an external device, like a cell phone mounted as a hard disk, and automatically sync the contents of the folder with your dropbox account.

What they promised is that for every 500MB of uploaded material through the autorun feature on the device uploaded to your profile, you will get it back for free with a limit of going up to 5GB, which is not something to joke about especially for the folks that have 2GB or 2.25GB only. (Tip: you get the first 500MB by just uploading a single photograph :))

How to get and use this build:

  1.  Go to this site http://forums.dropbox.com/forum-build.php which will guide you to the page the build information
  2. Download one of the distributions, depending on your system. (The day this article was written this was the latest build for Windows:
    > Windows: http://dl-web.dropbox.com/u/17/Dropbox%201.3.14.exe
  3. Of course install it as usual, and when you are done make sure it is running
  4. After that, mount your mobile device as an external disk drive to your computer and wait for the autorun menu to appear (if it doesn’t go to ‘My Computer’, right click on the device and select autorun)
  5. From the new window select the dropbox functionality as follows and give it some time to do its magic 🙂

Note: All uploaded photos will be renamed to this format  “<Year>-<Month>-<Day> <Hour>.<Minute>.<Second?>-<Increasing Number if needed>”(e.g 2012-02-07 15.12.22.jpg) but they will not lose their EXIF information.

Note: You will be able to find your uploaded photographs in the folder ‘Camera Uploads’ in the main folder of your dropbox account.

Sources:
(2/1) – Experimental Forum Build – 1.3.12
(2/7) – Experimental Forum Build – 1.3.14
These threads could become obsolete any day now so be sure to check out this page (newer forum build), which we believe will keep on taking you to the latest information.