Monday, December 30, 2013

Debian Release 7.3. Reboot issue: /dev/sda1 was not cleanly unmounted check forced.

I have faced with issue in Debian 7.3 release.
On restarting or shutdown - OS was hanging: i had a black screen and nothing was happening after that.
At first time i thought that it could be only once, but it was repeated on each restarting or shutting down.
After PC hanged nothing was possible to do - only turning off and turning on PC - even reset button didn't work.
So, i needed to start PC manually and on next boot i was receiving error message:
/dev/sda1 was not cleanly unmounted check forced.
So, to restart my PC i needed to shutdown with shutdown button, then start, wait when harddisk is checked and then run fsck utility manually to check disk.
It was very boring, so i decided to fix the issue.

At first time i thought, that it could be because of Debian is installed on external USB HDD which is on USB 3.0.
I was trying to use another USB 3.0 port and use USB 2.0, but was no luck.
Then i have checked logs and there also was no errors related with /dev/sda1.
Then i started to search in web and i found that someone also have faced with similar problems, but there was no the solution.
In common i spent about all day to fix the issue, i tried a different things, i wrote on forums - nobody gave me the answer.

Then my best friend give me advice - try to update Debian to newer version.
I have updated Debian from version:
Linux m4p-debian 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
to
Linux m4p-debian 3.12.0-031200-generic #201311031935 SMP Mon Nov 4 00:36:54 UTC 2013 x86_64 GNU/Linux

After update - restarting shutdowning is ok and i am really greatful to my friend.
Thank you, Vitya!

Hope this post will be helpful to someone.

Thursday, December 26, 2013

How to create bootable USB flash for Linux install from Windows?

Supposed user is using Windows OS and want to make bootable USB flash for Linux distributive.
Steps that is needed to do:
  1. It is needed to download distributive of linux as iso image.
  2. It is needed to download Win32DiskImager
  3. Run Win32DiskImager and select the image file.
  4. Select device.
  5. Press Write.
Enjoy!

Sunday, December 1, 2013

What are database normal forms: 1NF, 2NF, 3NF, BCNF? Difference between 3NF and BCNF.

Assumed reader is already acquainted with relational databases theory.
Definitions of 2 NF and 3 NF is given asusming only one candidate key, which is thus the primary key.

1 NF

A relation is in 1NF if and only if all underlying domains contain scalar values only.

2 NF

A relation is in 2NF if and only if it is in 1NF and every nonkey attribute is irreducibly dependent on the primary key.

3NF

A relation is in 3NF if and only if it is in 2NF and every nonkey attribute is nontransitively dependent on the primary key.

BCNF

A relation R is in BCNF if and only if for every one of its functional dependencies X → Y, at least one of the following conditions hold:
  • X → Y is a trivial functional dependency (Y ⊆ X)
  • X is a superkey for relation R
Superkey is a set of attributes of a relation schema upon which all attributes of the schema are functionally dependent. For example, if we have relation schema with attributes {X, Y, Z, Value}, then superkey is a subset  {X, Y, Z}→ Value.


Difference between 3NF and BCNF

Difference between 3NF and BCNF forms could be only if relation has at least two potential keys which is composite and two or more potential keys are overlapped  (i.e. has one or more common attributes).
Let suppose we had relation variable SST with attributes  Student, Subject, Teacher.
There is two constraints for this relation:
  • Every student is learning the subject only in the one teacher;
  • Every teacher teaches only one subject, but each subject could be teached by several teachers.

Below is the example of relation variable value:

Functional dependencies which determinated by constraints:
{ Student, Subject} → Teacher
{Teacher} → {Subject}

Candidate keys: {Student, Subject}, {Student, Teacher}.
As you see we have two candidate keys which is composite and it are overlapped, because attribute Student is common attribute.

Is relation variable SST in 3NF?

Answer is yes, because in both cases non-key attribute has irreducibly non-transitive dependency from key: {Student, Subject} → Teacher or {Student, Teacher} → Subject.

Is relation variable SST in BCNF?

Answer is no, because for dependency {Teacher} → Subject we don't have potential key where determinant of it is Teacher.


Refrences
[1]. Normal forms on trumpetpower.com
[2]. Date, C. J. (1999), An Introduction to Database Systems (8th ed.). Addison-Wesley Longman. ISBN 0-321-19784-4.
[3]. Candidate key, the free encyclopedia