Index: uspace/lib/gpt/libgpt.c
===================================================================
--- uspace/lib/gpt/libgpt.c	(revision 2b55edb3c9ee72f1dbe4878d2663fac0493c75a9)
+++ uspace/lib/gpt/libgpt.c	(revision 493b881e774a9aedae2d1e72627aeddd2ac91f96)
@@ -364,7 +364,7 @@
 	label->gpt->header->fillries = host2uint32_t_le(fillries);
 	uint64_t arr_blocks = (fillries * sizeof(gpt_entry_t)) / b_size;
-	label->gpt->header->first_usable_lba = host2uint64_t_le(arr_blocks + 1);
-	uint64_t first_lba = n_blocks - arr_blocks - 2;
-	label->gpt->header->last_usable_lba = host2uint64_t_le(first_lba);
+	uint64_t gpt_space = arr_blocks + GPT_HDR_BS + 1; /* +1 for Protective MBR */
+	label->gpt->header->first_usable_lba = host2uint64_t_le(gpt_space);
+	label->gpt->header->last_usable_lba = host2uint64_t_le(n_blocks - gpt_space - 1);
 	
 	/* Perform checks */
@@ -373,6 +373,7 @@
 			continue;
 		
-		if (!check_encaps(p, n_blocks, first_lba)) {
+		if (!check_encaps(p, n_blocks, gpt_space)) {
 			rc = ERANGE;
+			printf("encaps with: %llu, %llu, %llu\n", n_blocks, gpt_space, gpt_get_end_lba(p));
 			goto fail;
 		}
@@ -384,4 +385,5 @@
 			if (gpt_get_part_type(p) != GPT_PTE_UNUSED) {
 				if (check_overlap(p, q)) {
+					printf("overlap with: %llu, %llu\n", gpt_get_start_lba(p), gpt_get_start_lba(q));
 					rc = ERANGE;
 					goto fail;
@@ -838,7 +840,7 @@
 static bool check_overlap(gpt_part_t * p1, gpt_part_t * p2)
 {
-	if (gpt_get_start_lba(p1) < gpt_get_start_lba(p2) && gpt_get_end_lba(p1) <= gpt_get_start_lba(p2)) {
+	if (gpt_get_start_lba(p1) < gpt_get_start_lba(p2) && gpt_get_end_lba(p1) < gpt_get_start_lba(p2)) {
 		return false;
-	} else if (gpt_get_start_lba(p1) > gpt_get_start_lba(p2) && gpt_get_end_lba(p2) <= gpt_get_start_lba(p1)) {
+	} else if (gpt_get_start_lba(p1) > gpt_get_start_lba(p2) && gpt_get_end_lba(p2) < gpt_get_start_lba(p1)) {
 		return false;
 	}
@@ -849,8 +851,9 @@
 static bool check_encaps(gpt_part_t *p, uint64_t n_blocks, uint64_t first_lba)
 {
-	uint64_t start = uint64_t_le2host(p->start_lba);
-	uint64_t end = uint64_t_le2host(p->end_lba);
-	
-	if (start >= first_lba && end < n_blocks - first_lba)
+	/* 
+	 * We allow "<=" in the second expression because it lacks MBR so 
+	 * it's by 1 block smaller.
+	 */
+	if (gpt_get_start_lba(p) >= first_lba && gpt_get_end_lba(p) <= n_blocks - first_lba)
 		return true;
 	
