Tuesday, February 8, 2011

How to backup your hard drive or system with Linux

I created this how to for personal use but thought others might find it useful, all the tools used in this are free and should be available for any version of Linux.
A plain text version of this how to is available here.

Terminal commands listed in a section of text will also be listed below the section for easy copy paste and will be denoted as follows. You should replace the parts in [square brackets] to fit your system.

========================================
[commands here]
========================================
(in terminal in Ubuntu you can paste a command by pressing "ctrl + shift + v")


First I recommend booting your system with a live linux CD so that none of your system partitions will be in use and can be backed up.
(this should work with any live linux CD, but I know all the steps listed will work with Ubuntu.)

Once you have booted from the live CD open up a terminal window and type "fdisk -l" this will list all your connected hard drives, your hard drive will most likely appear as /dev/sda, or /dev/hda. Also under each hard drive there should be a list of partitions, you can use that list if you only want to backup a single partition not the whole hard drive.
========================================
sudo fdisk -l
========================================

You can also use the output of "frisk -l" to help speed up the backup, if you don't care about speed you can skip this step. If you want just the info you need on the hard drive you are backing up you can use this command, "fdisk -l /dev/[your drive] | grep Units"
Look in the output for where is says "Units = cylinders of [num1] * [num2] = [big_num] bytes" num2 is the number of bytes per block on the disk. You can improve the speed of the backup by increasing the block size by a multiple of 2 to 4, remember the number for later.
========================================
sudo fdisk -l /dev/[your drive] | grep Units
========================================



So if you want to back your full hard drive I suggest you use the following command,
"sudo dd if=/dev/[your hard] bs=[num2 x 2] conv=noerror,sync | gzip -c -9 > /[your backup folder]/drive_backup.gz",
the actual command will depend on your system but should look something like this:
"sudo dd if=/dev/sda bs=1024 conv=noerror,sync | gzip -c -9 > /HDD_backups/backup_sda.gz"

You could also use one of these other similar commands depending on your needs.

This command will copy from one hard drive to another.
sudo dd if=/dev/sdx of=/dev/sdy bs=1024 conv=noerror,sync

This command will copy to an uncompressed image file, which will be the same size as your hard drive.
sudo dd if=/dev/sdx of=/path/to/hard_drive.img bs=1024 conv=noerror,sync

(sdx could be sda, sdb, hda, or hdb etc.)

Full Hard Drive Backup
========================================
sudo dd if=/dev/[your drive] bs=[num2 x 2] conv=noerror,sync | gzip -c -9 > /[your backup folder]/drive_backup.gz
========================================


If you only need to backup a single partition the command is similar to the full hard drive backup, and will look something like this,
"sudo dd if=/dev/sda1 bs=1024 conv=noerror,sync | gzip -c -9 > /HDD_backups/backup_sda1.gz"
The number following sda should be the number of the partition you want to backup. Also you can modify any of the previously listed commands to let you just copy a single partition.

Single Partition Backup
========================================
sudo dd if=/dev/[your drive][part num] bs=[num2 x 2] conv=noerror,sync | gzip -c -9 > /[your backup folder]/part_backup.gz
========================================

To restore your compressed hard drive backup you'll want to run this command,
"sudo gzip -dc /HDD_backups/backup_sda.gz | dd of=/dev/sdx"
To restore your uncompressed hard drive backup you'll want to run this command, "sudo dd if=/path/to/hard_drive.img of=/dev/sdx bs=1024 conv=noerror,sync"

Full Hard Drive Restore
========================================
sudo gzip -dc /[your backup folder]/drive_backup.gz | dd of=/dev/[your drive]
========================================

Single Partition Restore
========================================
sudo gzip -dc /[your backup folder]/part_backup.gz | dd of=/dev/[your drive][part num]
========================================

Other backups you might want to do while you are booted from a live linux CD.

MBR backup + Partition Table

sudo dd if=/dev/sdx of=/path/to/MBR_Part_backup.img count=1 bs=512


MBR restore

sudo dd if=/path/to/MBR_Part_backup.img of=/dev/sdx

Add "count=1 bs=446" to exclude the partition table from being written to disk. If you want to manually restore the partition table.


Backup the Partition Layout

sudo sfdisk -d /dev/sda > /mirror/backup-sda.sf

When you create a whole disk backup, you don't have to worry about partitions. However, it can be handy to have this partition information (in case you need to mount a specific partition in the backup as a file using the exact offset).



This How To was put together by Tim the Enchanter (tim.the.enchanter88@gmail.com)

References used
- help and man pages for all the above commands
- http://mark.koli.ch/2009/05/howto-whole-disk-backups-with-dd-gzip-and-p7zip.html
- http://www.debianhelp.co.uk/ddcommand.htm
- http://wiki.linuxquestions.org/wiki/Dd

Friday, November 12, 2010

Thoughts on Church

There was something I couldn’t understand for a long time; it was that some people didn’t like to go to church. For me, even when I was young I enjoyed going to church, and now in my life as a young adult it is one of the major highlights of my week. I love my church. I love the people and the fellowship. I love worshipping my God. I love learning more about how to serve the God I love. I mean what is not to enjoy, does any of that sound boring to you? I will admit that sometimes I nod off for a few seconds during a sermon but it is not because I don’t want to listen; It’s because I’m not very good at going to bed and getting enough sleep. I think one of the problems with many churches is that they don’t every get to the really meat. They like to stay in the simple stuff, just have spiritual milk; it’s not possible to grow to the fullness of our spiritual strength on just milk. As Paul says, we have to have solid food. We need to hear about, consider, and wrestle with the deep and tough issues of our faith. We need a deep faith that permeates everything in our life. Our faith should not be limited to Sunday mornings and when we are with certain friends, it should be who we are all the time; it must be our core. I think a reason that many people don’t like church is because their home church is not challenging them. It’s just a surface level faith, and there isn’t a reason to go to a church like that.
Have you ever noticed how emotions are contagious? Say you’re feeling a bit down and you start hanging out with your friend who is really happy, you’ll probably smiling yourself by the time you two part ways. In addition, hanging around depressed people gets depressing… It’s just the way God wired us to rejoice with those who rejoice and weep with those who weep. Funerals and weddings are two examples of when we do that. I think that our love for God should be contagious. It should just spill out of us, and sweep other people along. You can think of it as either a rushing river or a roaring fire. Either way if you get close enough it will change you. The things in the path will not be the same after the affect. It should be the same with the Gospel in a person’s life, especially our own life. If we aren’t changed then we probably haven’t been swept away by the flood or burning for the Lord.
Going to church should be like giving a fire oxygen and fuel; it should burn hotter and brighter. When you go to church you need real fuel, sometimes I think church just want to throw a little lighter fluid on the fire; it might flare up for a little bit but it dies down really quick. We need the solid stuff if the fire is going to last. When you build a fire, you may start with small stuff and you may put some lighter fluid on to help it start, but if you want a fire to continue to burn, you have to put in a few logs.


I didn't put verses in here although I sort of referenced a couple. I feel like my post has kind of rambled, but I guess the idea I hope I communicated is that we should be excited about going to church and church should build us up so that we stay strong.

Wednesday, September 29, 2010

The Lie

I am alone. I am the only one… I am the only one who has been here. I am the only one who has been in this situation. I am the only one who has had to fight this. I am the only one who has had this struggle. No one else has ever been here before.

Many Christians seem to believe that they are unique in their struggles. That no one will understand their problems and they will be shunned. Paul addresses this in 1 Corinthians 10:13 when he tells us, “The temptations in your life are no different from what others experience. And God is faithful. He will not allow the temptation to be more than you can stand. When you are tempted, He will show you a way out so that you can endure.” (NLT) Looking at the first part of the verse we see that all humans experience the same temptations. I have found in my own life that when we start to talk about our struggles with other people they often can relate, sometimes they are going through the same thing, or they have been there. It is an encouragement to know that I don’t walk the path alone, and to know that others have conquered. It gives me hope to others who are still fighting and who have won the fight.

The devil loves to get us cornered and alone, to feed us the lie that we can’t be a part of the rest of the body. We are encouraged in the Bible to be open an honest with each other. James 5:16 says, “Confess your sins to each other and pray for each other so that you may be healed. The earnest prayer of a righteous person has great power and produces wonderful results.” Once we have confessed our sins then our Christian brothers and sisters can lift us up in their prayers. The prayer of God’s people is effective and God does answer prayer. Also in Galatians 6:1 “Dear brothers and sisters, if another believer is overcome by some sin, you who are godly should gently and humbly help that person back onto the right path. And be careful not to fall into the same temptation yourself.” We are called to love and restore our brothers in Christ. We all sin and eventually it will come out, we are not to condemn a person for sinning, but rather pray with that person so that they may be strengthen to walk with Christ. We are the body of Christ, some would say that we are only as strong as the weakest member, but I believe that when all the members work together we are stronger than the strongest member. When we trust in the power of God and work together as the body of Christ we can do all things.

We are never alone. Not only is God always there holding us in His hand but He brings into our lives exactly the right people to help us and walk with us.


I feel like I should have posted this before now but I believe it is better late than never, and God is in control. Also all the passages quoted were taken from the New Living Translation.

Wednesday, June 16, 2010

The River of Life

It’s been far too long since I have blogged, so first an update about my summer. I have a job, in Tulsa, which is a huge praise the Lord. I am working for True Digital Security and so far it’s been interesting so that is also a blessing. I think that’s what is major that has happened for me, on to the real topic of the blog.

I haven’t written in awhile because I have not felt like God has given me anything to share. But this Sunday during worship I felt like He gave me another picture. So I’m going to share it.

This is my picture as best as I can describe it.
The path of life leads into the middle of the river; it’s a river of blood, the cleansing blood of Christ. But I think it is often easier to walk in the shallows or even on the bank. What I don’t notice is that on the bank the dirt and mud cling to me and soil my robes. I wash my feet in the shallows but I am not completely clean. When the bank becomes rocky and covered in brambles I am forced to make a choice, to wade deeper into the water and swim, or to leave the river and walk inland away from the river of life. As the rocks push me into the middle of the river it deepens and I can no longer touch the bottom. So I begin to swim and I discover a wonderful truth, the current is not rough, it is a gentle current and it lifts me and carries me. It is easier than walking and I am cleansed by it. I know that the current follows the path that I must follow, and I know Who waits for me at the end of the river, because He loves me and shed His blood so I could make it to Him, so I could be clean.

Just some of the meaning I see (maybe you’ll see something different)
When life is easy we think it is easier to get out and walk on our own when we really need to stay and let Christ carry us, and during the hard times we are forced to trust Him to carry us, the river is flowing and even if we walk away, it is still there, we just may have to search hard to find it again, but no matter how dirty we get His blood still cleanses us.

Revelations 1:5b "All glory to Him who loves us and has freed us from our sins by shedding His blood for us." (NLT)

God Bless, Tim

Wednesday, March 3, 2010

Blood and blank forms

February 28th, 2010

So this last Sunday, I was worship at Bridgeway church and we stared signing the song “Nothing But The Blood.” For those who don’t know the song, the chorus is:

“What can wash away my sin?
Nothing but the blood of Jesus;
What can make me whole again?
Nothing but the blood of Jesus.”
As I was in prayer in the presence of God focused on the words of the song the Lord gave me a picture, or a vision depending on what you want to call it.
What I saw was two forms. They were on brown parchment with lines where words should have been. They were uniform except at the bottom there was a place to sign. I knew that they were contracts but there were no conditions. Two things puzzled me; one why were there two contracts, two why were they both blank. I asked God and felt like He said that one contract was to have my sin washed away and the second was to be made whole again, and the reason that they were both blank was because I didn’t have to do anything.
All I had to do to be wash clean and made new was to sign and accept it. The forms are blank because God is giving it away, and we only have to accept it, He doesn’t require anything. Christ loves me so much that He shed His blood and is giving it away freely if we just accept, but we have accept it we can’t walk away and try to earn it or find it.

As Paul said “we preach Christ crucified: a stumbling block to Jews and foolishness to Gentiles.” 1 Corinthians 1:23 (NIV)

Tuesday, February 2, 2010

Psalm 23... actually 32

The first question I must ask is why am I still awake... Well it's because my sleep schedule is pretty screwed up, but since I'm up I feel the need to blog there are two things I want to blog about but I should sleep so I'm just going to blog about one.

I was able to spend some good time this evening with God and I felt like He told me to read Psalm 23 which is a good Psalm but not the Psalm He actually had for me. As I flipped to 23 in my Bible I noticed Psalm 32, and transposition of 23. I decided that after I read Psalm 23 I would read 32. It is an amazing Psalm. (I know the whole Bible is an amazing book) Psalm 32 was exactly what I needed to hear right now.

Psalm 32 (NLT)
(A psalm of David.)

Oh, what joy for those
whose disobedience is forgiven,
whose sin is put out of sight!
Yes, what joy for those
whose record the Lord has cleared of guilt,
whose lives are lived in complete honesty!
When I refused to confess my sin,
my body wasted away,
and I groaned all day long.
Day and night your hand of discipline was heavy on me.
My strength evaporated like water in the summer heat.
Interlude

Finally, I confessed all my sins to you
and stopped trying to hide my guilt.
I said to myself, “I will confess my rebellion to the Lord.”
And you forgave me! All my guilt is gone.
Interlude

Therefore, let all the godly pray to you while there is still time,
that they may not drown in the floodwaters of judgment.
For you are my hiding place;
you protect me from trouble.
You surround me with songs of victory.
Interlude

The Lord says, “I will guide you along the best pathway for your life.
I will advise you and watch over you.
Do not be like a senseless horse or mule
that needs a bit and bridle to keep it under control.”

Many sorrows come to the wicked,
but unfailing love surrounds those who trust the Lord.
So rejoice in the Lord and be glad, all you who obey him!
Shout for joy, all you whose hearts are pure!

Part of me wants to say how every part of this just spoke to me but I really do need to sleep. So in short, God is so forgiving and I am thankful. :)

Thursday, January 21, 2010

some thoughts...

so I'm blogging because I'm not sure where to put my thoughts, let me first say nothing major or life changing has happened.

I am just tired and my emotions are near the surface… So I'm going to write about it?
So right now I'm battling "what ifs'." But right now I'm wondering not if I did something that was stupid or wrong, but if I should have done something… I made a choice and said I won't do that now I wonder if I blew it, if I missed it. Now I'm stuck, for so many reasons, I am in limbo. I don't know what the future holds

I know right now I need to be focused on God and what He is teaching me in this moment. I need to bury myself in His amazingness and hold on to His love and thank Him with trembling for His grace. I need God to be my only source of strength and purpose. I need to fall in love with Him again, and it need to be a choice based not on emotion.

So I really just need to make sure that I am hanging out close to God all the time…

Talking about only helps some, so, the end.