Improve and track your sleeping patterns with Zeo Sleep Manager Pro

What is Zeo Sleep Manager Pro

Zeo Sleep Manager Pro is a system composed of a headband sensor and a Bluetooth transmitter unit. It records the brainwave activity (during sleep) and send the data to another Bluetooth capable device for recording and further analysis.

The Zeo headband connects to software running on an iOS or Android device (via Bluetooth).

Additionally, Zeo provides a website where your sleep data can be uploaded so you can analyze the data or export it for use with other software.

In this blog post, I will be sharing with you my experience with this unit and a couple of tips on how to improve your sleep.

Sleeping tips

Before I give some tangible examples on how Zeo Sleep manager can help you learn more about your sleep quality, let me share with you a few sleeping tips.

Basic sleep hygiene practices:

  • Slow down your mind: do relaxing activities before going to bed,, do not keep on working and then abruptly try to go to sleep. Your mind will keep on “rolling” and will take the problems with it. Slow your mind down before going to sleep
  • Don’t feast at night: Unless you want to watch lots of action dreams or nightmares, do not eat heavy meals before going to sleep! You don’t want to make your body busy digesting. You want to have your body rejuvenate itself
  • Your bedroom is for sleeping only: while you can do other “stuff” in your bedroom, essentially keep unpleasant and distracting activities outside the bedroom. No computers, eating, playing with your electronic devices all night long, etc…
  • Organized sleeping time: your body loves order and routine (same like your mind loves patterns). Make a habit to sleep no longer than 10PM each night and learn how to wake up naturally without an alarm.

…and the list goes on, but you get the idea.

What if I cannot fall asleep

This topic requires a blog post on its own. If there is something I learned during my quest for better sleep, it is the fact that if you are in bed, tossing around and around not able to sleep then don’t stress about it! Accept that fact and relax until you eventually lose consciousness and drift into sleep.

How can Zeo Sleep Manager Pro help me with my sleep?

Feedback, feedback, feedback! Feedback plays a key role in learning and education.

Imagine that you are taught a new skill but never given feedback whether you are doing things correctly or not!

You may end up learning the skill the wrong way. For instance, learning calligraphy. If you draw the characters in a wrong way then nobody will be able to read what you write and thus voiding all your learning efforts.

The same applies for sleep, if we can really measure how and what is the quality of our nightly sleep then we can do conscious effort to improve.

Let us now talk about the different kinds of feedback that can help in improving the sleep quality.

Sleep stages and quality

The stages of sleep and the quality of rejuvenation and well being they provide is a science by itself. I encourage you to research about that topic.

With Zeo sleep manager, you will be able to measure how much time you spent in each sleep stage:

one-night-data
The MySleep Zeo website will teach you about each stage and provide lots of hints on how to increase the time spent in certain sleep stages.

Getting enough sleep

Getting enough sleep is always your responsibility.

Before I got my Zeo sleep manager pro device, it was hard for me to be consistent with my sleep time. Each day I promise myself to go to bed early but the motivation does not last for too long. Later I find myself sleeping too late and waking up early (due to obligations) and dragging myself throughout the day.

With Zeo sleep manager, tracking the time you go to bed, the number of times you wake up during the night and the time you wake up in the morning is automatically monitored for you.

The moment you put the headband, Zeo will start recording your brain activity to figure out if you are asleep and in which sleep stage you are.

In the following screenshot, we can see the following:

  • Sleep time: 12:34am
  • Rise time: 7:10am
  • Total sleep: 5:48 hours
  • Sleep stage and timing
  • ZQ: The Zeo sleep score. Pretty low

one-night-bad

What can I improve in this scenario? Be responsible and sleep earlier.

In the following screenshot, we can clearly see how sleeping earlier made a big difference in the overall sleep quality:

better-night

In conclusion, being responsible about when to sleep makes a big difference.

Tracking sleep data over days, weeks and months

Tracking one night data is so helpful already, but seeing how you progress along the week and the following months is insightful.

This screenshot below shows one week of ZQ data:

sleep-overall

Whereas the screenshot below shows more details:

sleep-graph-feb

Followed by the breakdown of data:

sleep-breakdown-feb

Seeing the overall picture help you improve your sleep quality.

Sleep journal

Sleeping journal is another kind of feedback that you can use to make correlation between your sleep quality and how you spent your day and how that affected your sleep.

Zeo comes with journal software that allows you to study that correlation (waking time and its effect to sleeping time):

sleep-journal

Waking up refreshed

How refreshed you feel when you wake up is a natural feedback you can use without any kind of gadget.

However, the Zeo sleep manager software comes with a special alarm feature that knows when to wake you up feeling refreshed.

The key idea behind this feature is that if we were awoken during a deep sleep stage then we may feel bad and not fully rested even if we sleep eight or more hours.

You tell Zeo what time you want to wake up and Zeo will use its sleep monitoring capability to wake you up within the set alarm time and when you are in a sleep stage that feels comfortable to wake up from.

This is much better than a traditional alarm clock that take no consideration what sleep stage you are at before waking you up “brutally”.

Closing words

I enjoyed putting efforts and time to write this blog post and share my experience with you.

I hope you found this blog post useful and got encouraged to purchase the Zeo Sleep Manager Pro . If want to buy Zeo, then please help me get referral points by clicking and purchasing through my Amazon.com associates link below:

 

Links and references

Leave a Comment

God of War: Ascension Collector’s Edition

Today I received my first ever “Collector’s Edition” game and it was my favorite game: “God of War” (or GoW in short).

I found out about God of War when I got my first PSP (Playstation Portable) to play the first God of War on it. Later I bought a PlayStation 2 only to play GoW I and GoW II.

When GoW III was out, I had to buy a PlayStation 3 to play this game! Smile

This is the contents of the pack (photo taken by me):

pack1

The collector’s edition comes with:

  • The game media in a very nice metallic case
  • Kratos action figure (as you can see in the picture above)
  • Digital manual for the game
  • Vouchers to download digital contents for:
    • Online pass activation code
    • The official game sountrack
    • 48 hour MP XP booster
    • PS3 dynamic theme
    • PSN Avatar pack
    • Pass for Future DLC releases
      • Last of Us Demo / early access
  • Demos for various titles on the same media disc:
    • Flower
    • Journey
    • Little BigPlant Karting
    • Sly Cooper: Thieves in Time
    • Sound Shapes
    • Starhawk
    • The Unfinished Swan
    • PlayStation All-Stars battle Royal

 

Buying the collector’s edition turned out to be a good deal!

If you plan on buying this pack then please help me get referral points by clicking and purchasing the game through my Amazon.com associates link below:

Additionally, if you purchase the this game edition from Amazon.com, you get:

  • God of War: Ascension™ Odysseus Multiplayer Pack (Product Voucher)
  • $10 credits from Amazon.com

Cheers!

Leave a Comment

Introduction To Fasting


 

Topic: Introduction To Fasting
Author: Elias Bachaalany

What is fasting

Fasting is the act of abstaining from food (all food). It is not as simple as it sounds for some nor impossible for others but for its proven therapeutical effects it will become worthwhile the efforts.

Fasting is not something new, it is mentioned throughout the book of Exodus. Moses, Elijah, Gandhi, Jesus and others fasted for up to 40 days. Christians also use a variation of fast, where they fast half a day and stop taking meat for a 40 days period. Also Muslim fast during Ramadan.

I may here note that starvation, the denial of food supply by accident or intent from a system that is in need of that food, is not fasting at all!

"We may talk about sex being the strongest fleshly drive, but it is not. We may think ego is the strongest of the fleshly impulses, but it is not. From the day we are born, the desire for food reigns dominant." [B]

How fasting works

It has been well documented that the less you eat the more healthy you become.
It is not the quantity that matters but the quality. By understanding our body’s needs, how it works and how much it really wants food supply, we can learn to become healthier with less efforts.

Our body is being constantly poisoned by the food we take (artificial colors, flavors, preservatives, pesticides, insecticides and other indigestible chemical substances). At some points our body will not be able to cope with all this stress and it will be overtaken at sudden, that is when one of our organs starts malfunctioning or at least a manifested disease will show its symptoms.

Man is never meant to be sick, GOD did not intend us so. Man has been expelled from Eden because he ate the wrong thing! We have been eating the wrong things ever since!

Our stomach (digestion system) is compared to a worker that knows no rest! It works constantly to sort out the food we take periodically and everyday, that’s why if we want our system to do its natural healing job we have to lessen our food intake so that the body directs its energy and efforts elsewhere.

"Fasting is a natural instinct among the animal kingdom when something is wrong with their bodies. They know to stop eating. We may not feel hungry when we are sick but we have been conditioned to eat for strength and to get well." [A]


A short list of what fasting can cure

Asthma Bronchitis Fever
Obesity Migraine headaches High/low blood pressure
Boils Psoriasis Constipation
Liver problems Tumors Gall stones

Types of Fasts

During a fast you may only take Water (and much better pure/distilled water). Water fasting is so much perfect that it requires dedication and extra care and cannot be practiced nowadays by everyone due to one’s busy life schedule.
Therefore a variation of fast types where put into practice by alternative health professionals and by individual health seekers.

  Water Fasting As mentioning earlier, this consists of taking only water (and at some extent squeeze of lemon is added).
During this type of fast you should avoid extensive physical, sexual and mental work and have plenty of rest!
You should also have a plenty of fresh air, sun light, avoiding stress.
You may do some Yoga exercises as it makes you feel vitalized and helps your body get rid of the toxins faster.

This sort of fasting is experienced fasters, because healing and symptoms might appear so quickly and a new comer might not be able to deal with them. In addition, you must check with your doctor before proceeding with such fasts.

  Juice Fasting Juice fasting is not really a fast, but an elimination diet. But the word "Fast" is just a terminology in that context. This sort of fasting yields the results of loosing weight, detoxifying and abstaining from solid foods.
This sort of fast is ideal for busy people that must work during their fast and cannot have complete rest. This sort of fast is so practical in a big polluted town where one needs to rejuvenate but has no means to do so.

During this fast, you may take only fresh juice (not pasteurized or canned juice).
Juices has been known to help the body detoxify, by stimulating different healing/eliminating organs in ones body (Liver, Kidneys, Colon), and clean the blood stream.

Why fresh juice?
Fresh juice are concentrated in vitamins, live enzymes and minerals. They are easily absorbed by the body.
This sort of fast can be extended to 30 days or more without real danger as opposite to water fasting.

Carrot juice combos are the best when it comes to Juice Fasting.
Fasters has derived a list of fruits and vegetables that can be of benefit during your fast:

  • Carrots: It has a variety of vitamins and minerals like: A-Carotene, Vit-B1, Riboflavin-B2, Iron, Phosphorus, Zinc, Sodium, Vit-B12, Vit-C, Vit-E, Dietary Fiber, … !
  • Apples: they are known as intestinal brooms! As they are also rich in fiber.
  • Green Juices: Greens drinks are best known for their energizing and healing effect. For example if you are feeling tired, one cup of wheatgrass will lit you up again.
    They are also excellent blood cleansers.
    The secret behind the power of the Green is the Chlorophyll. "Without the Chlorophyll all animal life on earth would become extinct". [C]
    Green plants take their energy directly from the sun into their cells and store it there.

What is amazing is that the color of the food/juice have different healing properties:

  • Red food: speeds up blood circulation, yang energy. Mostly found in: Tomatoes, hot peppers, watermelon, red cabbage, …
  • Orange food: Known as an anti-spasmodic and an excellent pain and cramps killer. It can effect you emotionally by increasing your joy and mental clarity. Mostly found in: Oranges, carrots, pumpkins, …
  • Yellow food: It strengthens the nerves, digestions and helps constipation. The yellow color is also associated with mental power and clarity. Mostly found in: Lemon, apple, peach, banana, mango, corn …
  • Green food: As discussed earlier, it is a blood cleanser, blood alkanizer and a nutrifier. Mostly found in: all green leafy vegetables and sprouts, …
  • Blue food: The color blue is associated with spirituality and mental work. Therefore it is good for headaches and for its tranquilizing effect too. Mostly found in: Grape, potato, celery, blueberry.
  Breatharianism Not that you don’t only take Solids or juices, but also Water!!
You may only take fresh air and the lovely sunshine. This type of fasting most be surely practiced in an unpolluted environment.

"Would that you could live on the fragrance of the earth and like an air plant be sustained by the light" — Khalil Gibran, The Prophet. [C]

  Liquitarianism You have more choices of juices to consume other than juices or waters, actually anything that is strained (contains no solids). A good example of that: Herbal Teas, Vegetable Broth, Nut milks, …
Most of these drinks are better taken when coming out of a fast and not during the fast.

As noted above, all these types have one thing in common: No Solid food is taken!

Fasts durations

One can never predict the real duration or length of a fast.
There is no hunger while the disease is there. "Because disease and hunger can never coexist." [D]
When real hunger returns, which can never be mistaken, then you might consider to return from your fast.

Generally, People sometimes follow systematic fast programs with a predefined length and type:

  Weekend Fasts It consists of fasting for one to three days at most and usually at the weekends, typically if you decided to have rest and restrain from work.
This sort of fast is suitable for all, because it can be done without a professional’s supervision and it can yield no side effects at all!

Another variation of this is the One day per week where one fasts any day during the week.
This might look not enough, but if you practice it, you will have fasted almost 52 days per year!
Your body will pay you later by extending your life span, avoiding you facing common diseases that most old people live with.

Also one might use the Every other day fasting method for weight loss purpose. This is practiced every other day and is also effective and not harmful!

Although the fasts types discussed above are beneficial, one might mis-practice them.
For example: Anorexia: A prolonged disorder of eating due to loss of appetite or even because of over-weight problems.
While the in Bulimia, people eat all over again what they missed during their fasting period and screw all the healing effect in just one day!
With this duration, one can Water fast and Juice fast.

  Short fasts Anything shorter than two weeks is considered a short fast.
This sort of fast is so practical for most people that work and cannot have time for fasting alone.
It can be done from home and work, mostly, juices are taken this period to help detoxify fast within the range of this fast.
  Long fasts This sort of fasts require medical consultation before and after the fasting period.
It is essential to have a clear purpose before proceeding.
This can be used for healing purposes, diet, spiritual goals, etc…
You have to be in vacation and without worries during this period so that all your energy start flowing inwards.

Entering a fast

Before beginning to fast, you might want to decide why you want to fast.
Commonly, people might have goals such as:

  • Diet and weight loosing
  • Breaking bad eating habits
  • For the sake of experiencing it
  • Spiritual goals
  • Changing diet: Normal diet to Vegetarian diet
  • Healing from diseases
  • Because you cannot eat due to surgery in the mouth

Whatever your purpose is, you have to keep in mind that fasting is something personal.
Some people would fast only to show off in front of their friends saying that they could fast a certain number of days.
So keep it personal, and do not consider fasting as a tool to cultivate your ego! Instead consider it as a tool to expand your mind and body.

The length of the fast depends on your purpose for fasting, for example to recover from a grave disease you may want to take a long fast; for weight loosing you can take short fasts (up to 2 weeks).
Something positive will happen during or after the fast, so keep yourself up to your expectations, if changes doesn’t happen during the fast or right after it, they will take place sooner or later.
Sometimes results appear later and after the fast because the body was working slowly and cleaning itself but it had not enough means and energy to expel the toxics. But once you resume your normal healthy diet, the body will be strong enough to throw every un-useful thing out.

Your doctor can decide whether your current health conditions allows you to fast or not.
Usually, the following are not advised to fast:

  • Pregnant women
  • Very old people
  • Diabetes
  • etc…

During the fast you might experience some healing or other disturbing symptoms:

  Cold It is usual that you feel cold during a fast.
The food we usually eat creates heat in our body, when the food is absent you won’t feel this usual heat any longer.
It is advised that you cover yourself well even though it is summer time and you might look silly in your society.
  Weakness Feeling weak during a fast is also a natural thing since there is no more extra energy supplied, instead the body is using all the energy stored inside it.
Whenever possible try to rest if you feel weak.
  Bad Breath Most fasters complain about their bad breath.
You can resolve this by having a squeeze of lemon on your tongue or by brushing your teeth frequently.
Do not consider taking a mint! That will break your fast.
  Dizziness/Headache

Toxics sting twice: on their way in and on their way out.
This might be a good symptom as your body already picked the toxics and they are already circulating in your blood waiting their turn to be expelled out of your system by your elimination organs.

  Constipation/diarrhea Constipation is natural because there is not enough wastes bulk so that your organs can easily expel.
Diarrhea can occur too and that is a good sign of elimination

During the fast, you might want to consider strengthening and taking extra care of your elimination organs:

  The skin The skin can eliminate dead cells and ever toxins that have been stuffed under your skin for ages.
Brush your skin very well regularly, take a sun bath; that is to have a douche under the sun.
  The bowel To avoid constipation it is advised to use a water enema every morning or night during your fasting period.
Water enema is not harmful at all if used correctly and not abused.
  The Kidney Its role is to eliminate fluid waste from the body.
Therefore, taking cleansing herbs will help the kidney do its job: Cucumber juice, herb teas, asparagus, celery, strawberry, etc…
  The Lungs By breathing correctly and fully with your lungs you help strengthen and cleanse this organ.
Yoga books heavily describe this subject.

Overall, keep yourself busy during the fast with:

  • Rest: Naps, Meditation, Sleeping, …
  • Exercising: Light walking, Yoga, Deep breathing
  • Cleansing: Rest

 

Coming out from the fast

You started feeling really hungry? your fast schedule is over? you gave up?
For whatever reason you ended your fasting period, you must pay close attention on how behave in the post fasting period.

It is natural that your eating desire has grown immense, as if a sleeping giant has just awakened and wants to eat!
The first part of this later statement is true, that your giant is sleeping (your stomach/digestive system), but the second part isn’t true at all, that is it wants to eat!

What actually happened during the fast, is that you put your digestive system into a rest state, and you cannot just wake it up just by re-introducing food into your system!

Fatal cases have been reported when people break their 6 days+ fast by eating a pizza! What happens is, in this case, the pizza is so strong for the system to handle it just after it was idle for a long period.
Your stomach capacity shrinks down, your glands, normal digestion procedure would take some time now to start working normally.

So please, Follow these steps carefully when coming out from the fast, *WILL POWER* is mandatory:

  Phase 1 This phase is the first 2 days (short fast) or 1 week (long fast) and even 2 weeks (in case of 40 days fasts).
During phase 1, you may only take liquid that have no solids at all.
You may have protein drinks like soya milk, or nut-milks.
By the end of this phase, you can introduce small bodies in your liquid, for example the pulp of the orange, …
Taking soup is also highly encouraged. (Still no solids at all)
  Phase 2

Similar to Phase 1, Phase 2 get defined by another period of light eating where now more small and less complex solids can be taken.
You might take a heavier soup now, with potato and other vegetable.

The key in this phase is to chew very well and to eat like a little baby and to nibble.

"You must chew your juice and drink your food"

What happens is that most of the digestion begins from the mouth. Because the saliva produces digestive enzymes that will simplify the work in your stomach.

  Phase 3 During this phase, you remember your purpose and expectations.
That is you might want to start by your healthy diet (Vegetarian for example) or you might want to overcome a certain eating disorder by eating properly now.

In phase 3 you will start feeling a change! you will feel full directly after eating a little, unlike old days when you eat a big quantity and you barely feel full.
That is a good sign that your body now knows how much it needs and what it needs.

What now?
I have introduced to you what fasting is and I have outlined important points and guidelines you should follow.
Should you decide to fast, please use this guide as a starting point then expand your knowledge by conducting your own research or by buying a lengthier book on this topic.

After all, Fasting should be the interest of all health seekers. That’s why I personally advise that you consider very well the "Once per week" fasting scheme.
Remember that we are not living to eat, but we eat to live. Food is only the fuel of our bodies.

Reference

Last updated 07/15/2004 | Articles home

Leave a Comment

Too much for the end of the world! :)

So, back in mid 2011, I stumbled upon a website that sells tickets to escape the earth as a safety measure regarding the foreseen end of the world (per the Mayan Calendar).

I found the idea of the website funny so I decided to chip in some money and get myself an intergalactic ticket! :)

One week after, I received the package. That gave me a sense of security, knowing that I will be saved in case of Armageddon! :)

The package contents

First, you receive the welcome letter:

letter

Followed by the letter, you receive your ID:

idcard

And finally the first class intergalactic ticket! :)

board-pass

Year 2013 came and the end of the world did not happen! :)

Too bad, I cannot refund my ticket! :P

See you when the next end of the world hype takes place.

Comments (1)

Rental Car and the car damage waiver insurance plan

Recently, I started going on personal trips in various States and each time I had to rent a car.

Renting a car means that not only you pay a daily rental rate for the car but are also offered to buy an optional LDW (Loss/Damage/Collision Waiver insurance plan aka LDW / CDW).

The LDW costs from $9 to $30 dollars a day. That could be the same rate as the car rental itself, thus you are paying double the price to rent a car.

So the question is, what are your options to save money and should you?

There are two answers to this question and each with its cons and pros.

Not buying the LDW

If you don’t buy the LDW, then you may be relying on two things:

  • Your primary insurance coverage
    • Call your insurance company and ask about the coverage rules.
    • There could be a 500$ deductible and an increase on your yearly premium fees
  • Your credit card company coverage
    • Some credit card companies offer coverage (Visa, AMEX, etc…)
    • Check with your CC company what is the extent of the coverage

Bottom line, if an accident happen, you may be still liable if either of the insurances you have fail you because of some hidden close you failed to read.

If you don’t have insurance it could be a disaster if an accident happen because the rental company will charge you for:

  • Loss of use: daily rate while the car is out of operation (being repaired for instance)
  • Towing
  • Their repair fees
  • Administrative fees
  • Diminishing value claims
  • etc….

This blog post is interesting and more detailed: http://blackadar.com/rental-cars-credit-cards-and-the-loss-damage-waiver/

Buying the LDW

If you choose to pay up to $30/day for the LDW provided by the rental company then you are buying peace of mind at a relatively high cost.

Beware that, if an accident happens and you are at fault then the LDW may become void. Check with the rental company.

On the positive side, if you buy the insurance and you’re not at fault then you are relieved from all the expenses.

Check this site that discusses Top 10 reasons to buy Rental Car Damage Waiver

Bottom line

I personally still but the LDW most of the times especially when:

  • I am traveling to new locations and have to do lots of driving around
  • Renting a car that I am not accustomed to driving (say a big car, a truck for moving furniture, etc…)
  • When it is a short rental period: buying the peace of mind is worth it

This site also shows the cons and pros with lots of interesting user comments:

http://www.mymoneyblog.com/do-you-buy-the-loss-damage-waiver-for-rental-cars.html

Comments (4)

Partition tables explained

Introduction

partition_viewer

I’ve always been curious about how disks are partitioned, and how the partition table looks like. This article will explain the format of the partition table and will provide a small tool (Partition Viewer) to demonstrate what we explained.

The information in this article apply for x86 systems, I don’t know about disk partitioning on other systems.
You are not required to have prior knowledge about disk partitioning; The goal of this article is to provide just the needed knowledge to understand disk partitioning, hence many details are left out for the readers to investigate by themselves.

Please note that this article does NOT cover the GPT (GUID Partition table).

Background

In this section I will introduce some concepts that are needed to understand the article.

When you purchase a new hard-disk with a given capacity, all you can do with it is read/write raw data from first address up to last address. You can achieve that with special tools that can read an unformatted/unpartitioned disk. The data you read/write have no standard structure but the structure you devise.

When we partition a disk, we are simply dividing the disk’s space into partitions (logical boundaries). For example a 10GB can be divided (theoratically) into as many partitions as one desires, say 3GB, 4GB and 3GB partitions.

[======10 GB============] (before partitioning)
[(3GB===)(4GB====)(3GB===)] (after partitioning)

Practically, disk partitioning is more than just dividing the disk’s space into smaller partitions, but also attaching a given structure to each partition.
Those structures are named “File systems”. You may have heard of FAT and NTFS file systems (supported by Microsoft Operating systems).

File systems are a way to allow you to store your data in an organized manner (managable by the host operating system). That is why disk-partitioning has rules and limits (discussed later). For example, you can create a 10GB partition but you cannot attach to it the FAT16 file system, since FAT16 can only manage up to 2GB of disk space. Each file system has its cons and pros, which are not discussed in this document.

To finalize the disk partitioning and file system relationship, you can imagine that a raw non-partitioned disk can be compared to a big room with no divisions where every employee scatters his stuff here and there, but when we divide (partitioning) that space with cubicals we have organized offices and rooms (File system).

Disk addressing and capacity limitation

In this section we will try to explain the disk addressing concepts.

Cylinder/Head/Sector (CHS) addressing

CHS stands for (C)ylinder/(H)ead/(S)ector addressing mode. Those three component together designates the target disk address.

Logical Block Addressing (LBA)

LBA is linear addressing mode, starting from address 0 up to the maximum addressable location in the disk.
As opposed to CHS addressing, LBA is much simpler and easier to understand and is used in modern operating systems.

MBR and partition table format

In this section we will explain about the MBR (Master Boot record) and the format of the partition table and where it is located on the physical disk.

The master boot record (MBR) is a structure that holds the boot loader program and the partition table. The MBR is always located at the very start of the disk, at LBA 0 or 0,0,1 in CHS addressing.

The length of the MBR structure is 512 bytes.

Offset (hex) Size (in bytes) Item
0×0-0x1BD 446 Boot loader
0x1BE-0x1FD 64 Partition table
0x1FE-0x1FF 2 Signature (should be 0×55, 0xAA)

Usually, the role of the MBR is to find which parition table is active, load its boot sector and execute it

The MBR loader can be infected with an MBR virus (sometimes refered to as bootkits) that runs even before the operating system boots (or the boot sector executes)

Boot loader

The boot loader is a program whose sole purpose is to interpret the partition table and decide which partition should be booted from.

The boot loader can be infected with a boot-sector virus that runs even before the operating system boots

Here are the usual steps that are done by the boot loader:

  1. Load the partition table
  2. Iterate through its entries looking for a partition entry marked as active
  3. Once an active partition is found, we load the correspondance boot sector of that partition
  4. If no active partitions are found then we halt
  5. Once an active partition is found and its corresponding boot sector is loaded, then MBR executes the MBR code

Boot sector

In the previous section we introduced the term “boot sector” which is not to be confused with MBR’s “boot loader”
The boot sector and the MBR are two different things.

A boot sector is yet another structure, 512 bytes in size, that is file-system specific.
Its function is to initiate the operating system and load it from the disk.

Since the MBR will load a boot sector and execute it, the least requirements for a boot sector are:

  1. Offset 0 should have a valid x86 instruction so that when MBR runs it, the code does not crash the system
  2. Offset 0x1FE should have the signature 0×55 0xAA (like the MBR)

In the case of MS-DOS, the boot sector program is responsible for loading IO.SYS and MS-DOS.SYS which will in turn load the COMMAND.COM

Partition Table

The partition table is 64 bytes long and is located inside the MBR at sector 0x1BE.

The partition table is an array of 4 partition table entries each of 16 bytes thus: 16×4 = 64.

The format of each parition table entry is the following:

Offset Size Item
0×00 1 Boot indicator; 0×80 = Active partition / 0×00 Inactive partition (boot_indicator)
0×01 1 partition start: head (chs_start.head)
0×02 1 partition start: sector (chs_start.sect)
0×03 1 partition start: cylinder (chs_start.cyl)
0×04 1 Partition ID (example ID=1 for FAT12) (system_indicator)
0×05 1 partition end: head (chs_end.head)
0×06 1 partition end: sector (chs_end.sector)
0×07 1 partition end: cylinder (chs_end.cyl)
0×08 4 Number of sectors before the beginning of this partition (sectors_before)
0x0C 4 Number of sectos in this partition (number_of_sectors)

You should note that the start and end CHS values are not as they are stored, instead, we have to extract their values from the bits.

real cylinder value = ((chs.sector >> 6) << 8) | (chs.cyl)
We take bits 6-7 from chs_sector which are the high bits of real_cyl_value and then combine them with chs_cyl which are the low bits of real_cyl_value.

The reason they are encoded that way, is because the BIOS INT 0×13/AH=0×02 function (which reads a sector) requires this encoding:

INT 13 - DISK - READ SECTOR(S) INTO MEMORY
	AH = 02h
	AL = number of sectors to read (must be nonzero)
	CH = low eight bits of cylinder number
	CL = sector number 1-63 (bits 0-5)
	     high two bits of cylinder (bits 6-7, hard disk only)
	DH = head number
	DL = drive number (bit 7 set for hard disk)
	ES:BX -> data buffer

The number_of_sectors field describes how many sectors are in this partition. This field can be used to determine the length of the partition.

Similarly we can use (CHS_ENDCHS_START) to determine the length of the partition.

The number of sectors before (at offset 8) designate where the partition data begins starting from the partition table definition. If in the MBR, an entry has sectors_before equal 63 then this means that the boot sector of that partition is located at sector 63

Primary and Extended partitions

A primary partition is a partition entry with an ID different than 5 and 15 and can have file system associated with it.

Extended partitions unlike primary partitions, have IDs 5 or 15 and cannot have a file system associated with them, instead they point to another partition table that have at most two partition table entries.

The second one can be an extended partition, thus nesting more paritions inside of it).

Extended partitions can be considered as just containers of other partitions. We will demonstrate partition table nesting next.

Partition table rules

The following partition table rules are take from other sources, I list only the most relevant ones (in the context of this article):

  • Only partition can be active at a time
  • In the MBR partition table: at most 4 primary partitions can be created, or 3 primary partitions and 1 extended partition
  • In the extended partition table: there can be 0 or 1 extended partition link and 0 or 1 non-extended partition (thus two in total)
  • Partition table entries can have any order (we can exchange entry 1 with 2, etc…)

Nested Partitions

Because of the structure of the partition table located in the MBR, we realize that we can have at most 4 partiton table entries in each partition table.

To overcome this limitation, special partition table entries are introduced that allow us to have an unlimited number of partitions that are linked together.

Inside the MBR, the extended partition entry describes the size of all the partitions that will be contained inside of it (using the nb_of_sectors field), whereas the NbSectorsBefore or CHS_START will be used to compute the link to the next partition table which can contain at most 2 partition table entries.

Those two entries are: (1) A normal partition entry (2) another extended partition entry pointing to the next linked partition.

Interpreting a partition table manually with a hex editor

In this section we will demonstrate how to interpret the partition table manually using a hex editor that can display disk sectors.

partition_explain1

This screenshot shows the first sector of the disk.

The bytes marked in yellow are the boot loader code.

The bytes marked in red are the signature of the MBR which should always be 0×55 0xAA.

The green area shows a complete partition table entry (16 bytes):

  • 00 : Boot indicator -> Inactive
  • 01 01 00 : CHS_START -> Head = 1, Sector = 1, Cyl = 0
  • 06: System Indicator -> FAT16B (>= 32 MB)
  • FE 3F 0B: CHS_END -> Head=254, Sector = 63, Cyl = 11
  • 3F 00 00 00: Sectors Before -> 63
  • CD F0 02 00: Number of sectos -> 192717

Which means that this is a FAT16 partition of ~96MB.

In the same manner we can interpret the result of the table and read it as:

Entry # Boot Indicator CHS_START System ID CHS_END Sectors Before Nb Sectors
1 0 0,1,1 6: FAT16B (>= 32 MB) 11,254,63 63 192717
2 0 166,0,1 15: Win95 Extended (LBA) 12543,254,63 2666790 26748225
3 0 13,0,1 23: Hidden IFS (HPFS/NTFS) 154,254,63 208845 2281230
4 0 12543,0,1 28: Hidden Win95 FAT32 (LBA) 12543,254,63 29415015 4128705

Notice that entry #2 is an extended partition (sysid = 15) of size: (26748225 * 512) = 13695091200 bytes = 13060 GB

This partition starts at sector 2666790 (sectors_before), let us go there and see the partition table pointed by it:

Entry# Boot Indicator CHS_START System ID CHS_END Sectors Before Nb Sectors
1 0 166,1,1 11: Win95 FAT32 178,254,63 63 208782
2 0 184,0,1 5: Extended 209,254,63 289170 417690

As we said, now every partition table that is pointed from the initial extended parition table entry have at most two entries.

The first entry is a normal entry and the second entry (type = extended) is a link to another partition table.

To compute the LBA of the second entry, we add to the sectors before the “sectors before” value from the extended partition table entry of the MBR, that is: 2666790+289170 = sector 2955960.

Now we go there and read the partition table:

Entry# Boot Indicator CHS_START System ID CHS_END Sectors Before Nb Sectors
1 0 184,1,1 6: FAT16B (>= 32 MB) 209,254,63 63 417627
2 0 240,0,1 5: Extended 255,254,255 1188810 17462655

Next partition table is at: 2666790+1188810 = sector 3855600.

Entry# Boot Indicator CHS_START System ID CHS_END Sectors Before Nb Sectors
1 0 240,1,1 7: Installable File System (NTFS, HPFS) 255,254,255 63 17462592
2 0 255,0,193 5: Extended 255,254,255 19069155 3919860

Next partition table is at: 2666790+19069155 = sector 21735945.

Entry# Boot Indicator CHS_START System ID CHS_END Sectors Before Nb Sectors
1 0 255,1,193 6: FAT16B (>= 32 MB) 255,254,255 63 3919797
2 0 255,0,193 5: Extended 255,254,255 23246055 433755

Next partition table is at: 2666790+23246055 = sector 25912845.

Entry# Boot Indicator CHS_START System ID CHS_END Sectors Before Nb Sectors
1 0 255,1,193 130: Linux swap / Solaris 255,254,255 63 433692
2 0 255,0,193 5: Extended 255,254,255 23679810 3068415

Next partition table is at: 2666790+23679810 = sector 26346600.

Entry# Boot Indicator CHS_START System ID CHS_END Sectors Before Nb Sectors
1 0 255,1,193 11: Win95 FAT32 255,254,255 63 3068352
0 0 0,0,0 0 0,0,0 0 0

No next entry; end of partition nesting.

Some Partition Table System IDs

The table below lists some of the known system ids (or file system ids).

ID Name
0×00 Empty
0×01 FAT12
0×02 XENIX root
0×03 XENIX usr
0×04 FAT16 <32MB
0×05 Extended
0×06 FAT16B (>= 32 MB)
0×07 Installable File System (NTFS HPFS)
0×08 AIX
0×09 AIX bootable
0x0A OS/2 Boot Manager
0x0B Win95 FAT32
0x0C Win95 FAT32 (LBA)
0x0E Win95 FAT16 (LBA)
0x0F Win95 Extended (LBA)
0×10 OPUS
0×11 Hidden FAT12
0×12 Compaq diagnostics
0×14 Hidden FAT16 <32MB
0×16 Hidden FAT16
0×17 Hidden IFS (HPFS/NTFS)
0×18 AST SmartSleep
0x1B Hidden Win95 FAT32
0x1C Hidden Win95 FAT32 (LBA)
0x1E Hidden Win95 FAT16 (LBA)
0×24 NEC DOS
0x2C WildFile/Adaptec GOBack
0×39 Plan 9
0x3C PowerQuest Recoverable Partition
0×40 Venix 80286
0×41 PPC PReP Boot
0×42 Veritas Logical Disk Manager
0x4d QNX4.x
0x4e QNX4.x 2nd part
0x4f QNX4.x 3rd part
0×50 OnTrack DM
0×51 OnTrack DM6 Aux1
0×52 CP/M
0×53 OnTrack DM6 Aux3
0×54 OnTrackDM6
0×55 EZ-Drive
0×56 Golden Bow
0x5c Priam Edisk
0×61 SpeedStor
0×63 GNU HURD or SysV
0×64 Novell Netware 286
0×65 Novell Netware (3.11 and 4.1)
0×66 Novell Netware 386
0×70 DiskSecure Multi-Boot
0×75 PC/IX
0×78 XOSL
0×80 Old Minix
0×81 Linux/Minix v1.4b+
0×82 Linux swap / Solaris
0×83 Linux native file system (Ext2/3)
0×84 OS/2 hiding type 04h partition
0×85 Linux extended
0×86 NT FAT volume set
0×87 NT IFS volume set
0x8e Linux LVM
0×93 Amoeba/Hidden Linux native file system (Ext2/3)
0×94 Amoeba BBT
0x9f BSD/OS
0xA0 IBM Thinkpad hibernation
0xA5 FreeBSD
0xA6 OpenBSD
0xA7 NeXTSTEP
0xA9 NetBSD
0xB7 BSDI fs
0xb8 BSDI swap
0xbb Boot Wizard hidden
0xc1 DRDOS / sec (FAT-12)
0xc4 DRDOS / sec (FAT-16 < 32M)
0xc6 Disabled NT FAT (FAT-16) volume set/DRDOS
0xc7 Syrinx / Disabled NT IFS volume set
0xda Non-FS data
0xdb CP/M / CTOS / …
0xde Dell Corporation diagnostic partition
0xdf BootIt
0xe1 DOS access
0xe3 DOS R/O
0xe4 SpeedStor
0xeb BeOS fs
0xee EFI GPT
0xef EFI (FAT-12/16/32)
0xf0 Linux/PA-RISC boot
0xf1 SpeedStor
0xf4 SpeedStor
0xf2 DOS secondary
0xfd Linux raid autodetect
0xfe LANstep
0xff Bad Track Table

PartitionViewer Tool

For the sake of demonstration, I wrote a tool that ships with the following components:

  • DiskSector.cpp/.h – A class to read/write raw disk sectors
  • partitionmanager.cpp/.h – A class that parses partition tables
  • MyDrawBar.cpp/.h – MFC static component to draw the partition tables
  • MyHistory.cpp/.h – MFC static component to draw the partition tables
  • PartitionViewer[Dlg].cpp/.h – The UI that uses the above helper classes

The PartitionViewer tool hardcodes only a small subset of the system IDs and colors:

static const MYHISTORYBARTYPECOLOR part_colors[] = 
{
  {0x0,  RGB(255,255,255), "Free space"},
  {0x6,  RGB(100,10,0), "FAT16B (>= 32 MB)"},
  {0xC,  RGB(255,0,128), "Win95 FAT32 (LBA)"},
  {0xE,  RGB(0,110,110), "Win95 FAT16 (LBA)"},
  {0x7,  RGB(200,0,20), "Installable File System (NTFS, HPFS)"},
  {0x0B, RGB(10,100,0), "Win95 FAT32"},
  {0x83, RGB(20,200,0), "Linux native file system (Ext2/3)"},
  {0x17, RGB(10,0,100), "Hidden IFS (HPFS/NTFS)"},
  {0x82, RGB(101, 12, 130), "Linux swap / Solaris"},
  {0x1C, RGB(90, 127, 30), "Hidden Win95 FAT32 (LBA)"},
  {0x1E, RGB(0, 0, 255), "Hidden Win95 FAT16 (LBA)"},
  {0x04, RGB(101, 12, 130), "FAT16 <32MB"}
};

Feel free to extend that list.

This program requires admin privilege to work because it accesses the disk sectors.

Once executed:

partition_viewer

the partitions will be visualized.

  • Use the dropdown list to select another drive then press the “Represent” button
  • Hover the mouse over the drawn area to display the partition information in the panel just below the drive dropdown list

Reference

I will like to acknowledge all the people who wrote all those articles, open source programs and references that made the writing of this article possible.

Conclusion

I hope you found this article useful. In the future, another article can be written to cover the GPT.

Please leave your comments or suggestions below and I will try to answer questions or fix the code as much as my (limited) time and my knowledge allow.

Donation to support this blog and encourage me to write more useful blog entries are welcome:

Download the sources and compiled binaries from here

Leave a Comment

How to show saved Windows 7 Wifi passwords

In this blog post, I am going to illustrate how to view saved Wifi keys under Windows 7 in four easy steps.

Step 1 – Right click on the wireless networks icon

r-click-wifi

After right clicking select “Open network and sharing center”

open-network

Step 2 – Select “Manage wireless networks”

manage

This will give you a list of previously configured wireless networks

Step 3 – Select the desired network

network-list

Select the desired network and double click it or right-click and select “Properties”

Step 4 – Reveal the password

In the properties dialog / “Security” tab, click on the “Show characters” checkbox to reveal the password:

show-characters

Comments (2)

Older Posts »
Follow

Get every new post delivered to your Inbox.