According to the Bible, was Jesus aware of his immortal nature at the time of the crucifixion? Or did he only become aware of it after the Ressurection?
No. Jesus did not have an immortal nature at the time of the crucifixion or he would not have been able to die. I do think Jesus was aware that He was eternal (John 17), mortal, and would be resurrected or have an immortal nature in the future.
Jesus was however aware that He would be resurrected, Matt 20:19. Jesus offered eternal life in John's gospel - One cannot offer something one does not have.
I'm assuming that you define "immortal" to mean "unable to permanently die".
The Bible indicates that death is a consequence of sin:
- For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord. (Romans 6:23)
- And you were dead in the trespasses and sins (Ephesians 2:1)
All of humanity has inherited a sinful nature, therefore everyone will eventually die:
- For all have sinned and fall short of the glory of God (Romans 3:23)
- Therefore, just as sin came into the world through one man, and death through sin, and so death spread to all men because all sinned. (Romans 5:12)
- [W]e all once lived in the passions of our flesh, carrying out the desires of the body and the mind, and were by nature children of wrath, like the rest of mankind. (Ephesians 2:3)
- If we say we have no sin, we deceive ourselves, and the truth is not in us. (1 John 1:8)
Jesus, being God taking on human flesh, never sinned, and therefore did not deserve to die:
- For we do not have a high priest who is unable to sympathize with our weaknesses, but one who in every respect has been tempted as we are, yet without sin. (Hebrews 4:15)
- He committed no sin, neither was deceit found in his mouth. (1 Peter 2:2)
When Jesus was crucified, He died in our place for our sins. Therefore, anyone who believes in Jesus is unable to permanently die, but will have eternal life (and could be said to be "immortal"):
- For God so loved the world, that he gave his only Son, that whoever believes in him should not perish but have eternal life. (John 3:16)
- Whoever believes in the Son has eternal life; whoever does not obey the Son shall not see life, but the wrath of God remains on him. (John 3:36)
- Truly, truly, I say to you, whoever hears my word and believes him who sent me has eternal life. He does not come into judgment, but has passed from death to life. (John 5:12)
- No one can come to me unless the Father who sent me draws him. And I will raise him up on the last day. (John 6:44)
- Jesus said to him, “I am the way, and the truth, and the life. No one comes to the Father except through me. (John 14:6)
- And this is eternal life, that they know you the only true God, and Jesus Christ whom you have sent. (John 17:3)
- He will render to each one according to his works: to those who by patience in well-doing seek for glory and honor and immortality, he will give eternal life; but for those who are self-seeking and do not obey the truth, but obey unrighteousness, there will be wrath and fury. (Romans 2:6-8)
- If the Spirit of him who raised Jesus from the dead dwells in you, he who raised Christ Jesus from the dead will also give life to your mortal bodies through his Spirit who dwells in you. (Romans 8:11)
- For our sake he made him to be sin who knew no sin, so that in him we might become the righteousness of God. (2 Corinthians 5:21)
- For by grace you have been saved through faith. And this is not your own doing; it is the gift of God, not a result of works, so that no one may boast. (Ephesians 2:8-9)
- How much more will the blood of Christ, who through the eternal Spirit offered himself without blemish to God, purify our conscience from dead works to serve the living God. (Hebrews 9:14)
Since Jesus is God taking on human flesh, He already knew all of this before He was crucified:
- For just as Jonah was three days and three nights in the belly of the great fish, so will the Son of Man be three days and three nights in the heart of the earth. (Matthew 12:40)
- From that time Jesus began to show his disciples that he must go to Jerusalem and suffer many things from the elders and chief priests and scribes, and be killed, and on the third day be raised. (Matthew 16:21)
- And he began to teach them that the Son of Man must suffer many things and be rejected by the elders and the chief priests and the scribes and be killed, and after three days rise again. And he said this plainly. (Mark 8:31-32)
- And as they were coming down the mountain, he charged them to tell no one what they had seen, until the Son of Man had risen from the dead. (Mark 9:9)
- [F]or he was teaching his disciples, saying to them, "The Son of Man is going to be delivered into the hands of men, and they will kill him. And when he is killed, after three days he will rise." (Mark 9:31)
- Saying, "See, we are going up to Jerusalem, and the Son of Man will be delivered over to the chief priests and the scribes, and they will condemn him to death and deliver him over to the Gentiles. And they will mock him and spit on him, and flog him and kill him. And after three days he will rise." (Mark 10:33-34)
- "We heard him say, 'I will destroy this temple that is made with hands, and in three days I will build another, not made with hands.'" (Mark 14:58)
- Saying, "The Son of Man must suffer many things and be rejected by the elders and chief priests and scribes, and be killed, and on the third day be raised." (Luke 9:22)
- Jesus answered them, “Destroy this temple, and in three days I will raise it up." (John 2:19)
(There are, of course, many more verses in the Bible that could answer your question, but I feel these should be enough for now.)
Because all sin, all die. Jesus committed no sin, so I think that since he fulfilled the law he would've remained and lived (like the LORD said so many times in the OT); God cannot take the life of an innocent man. That innocent man, however, can lay his own life down, if he knows how to separate body and spirit. This particular man CREATED the thing that condemns as well as the thing that gives life, so earning eternal life doesn't seem like something Jesus had to do. He says that He is the resurrection and the life (and judging by Lazarus, I'd say he could keep all he wanted alive including himself). I think he was aware of it, but wasn't allowed to make use of it for his own glory and to condemn sin and renew us.
I just have a hard time thinking that the natural path of this man's life was death even if he hadn't laid down his own life purposefully. I think the only way for him to have died is by his actively trying to die.