08 Oct 2009 @ 11:57 AM 

DD has always worked great for me. If you have similar partitions and fs then you can backup and restore to it. You might run into problems if you had a 10gig partition on sda ext2 and then you try and restore it later to sdb5 ext3 or something like that ? Anyway, some backup is better than no backup. I’m using a ext4 fs and backing my whole disk up to a “dump” using the dd command. Later I might opt to backing up to a partition so i can have a mirror image, but for now this is good.

I use gnu screen because the backups take forever, this way i can detach and go do other stuff.

zonemikel@GalacticAC:/mnt/sda1$ sudo fdisk -l
 
Disk /dev/sda: 164.6 GB, 164696555520 bytes
255 heads, 63 sectors/track, 20023 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x9eb99eb9
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        1275    10241406   83  Linux        <----- backing up to here for now
/dev/sda2            1276        2550    10241437+  83  Linux
/dev/sda3            2551        2677     1020127+  82  Linux swap / Solaris
/dev/sda4            2678       20023   139331745   83  Linux
 
Disk /dev/sdb: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8f670ed7
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2403    19302066   8e  Linux LVM         <------------- Root partition
/dev/sdb2            2404        2434      249007+   5  Extended
/dev/sdb5            2404        2434      248976   83  Linux
zonemikel@GalacticAC:/mnt/sda1$ screen sudo dd if=/dev/sdb1 of=/mnt/sda1/ubuntu_dump_Oct_08_09.dump bs=64M

After i detached i went to see if the file was growing and it indeed was.

zonemikel@GalacticAC:/mnt/sda1$ ls -l
total 426216
drwx------ 2 root root     16384 2009-09-06 18:22 lost+found
-rw-r--r-- 1 root root 436428800 2009-10-08 11:51 ubuntu_dump_Oct_08_09.dump
zonemikel@GalacticAC:/mnt/sda1$ ls -l
total 5373972
drwx------ 2 root root      16384 2009-09-06 18:22 lost+found
-rw-r--r-- 1 root root 5502926848 2009-10-08 11:56 ubuntu_dump_Oct_08_09.dump
zonemikel@GalacticAC:/mnt/sda1$ ls -l
total 5628820
drwx------ 2 root root      16384 2009-09-06 18:22 lost+found
-rw-r--r-- 1 root root 5763891200 2009-10-08 11:56 ubuntu_dump_Oct_08_09.dump
zonemikel@GalacticAC:/mnt/sda1$

and if i ever wanted to restore

sudo dd if=/mnt/sda1/ubuntu_dump_Oct_08_09.dump of=/dev/sdb1 bs=64M

UPDATE:
Well this has saved me a bunch of times, I’m wanting to add this info here so I dont forget it.

Adding noerror makes it so dd wont stop if there is a error it will just fill the places it cant read with zero’s (thats the sync option) and continue on.
The “&” at the end makes it so it runs in the background, this way you can do whatever you want and it will finish when it finishes. It then shows you the process id and gives you another prompt.

zonemikel@GalacticAC:/mnt$ sudo dd if=/dev/sda1 of=/mnt/sdb1/ub_9.10_11.24.09.dump bs=512 conv=noerror,sync&
[1] 3530
zonemikel@GalacticAC:/mnt$

If you want to see the speed/progress of the dd command it sounds weird but you have to send it this kill command. You send it to the proc id that we found above or by “ps aux | grep dd”

zonemikel@GalacticAC:/mnt$ sudo kill -USR1 3530
zonemikel@GalacticAC:/mnt$ 5024233+0 records in
5024233+0 records out
2572407296 bytes (2.6 GB) copied, 376.458 s, 6.8 MB/s

Then if you want to restore someday. The notrunc tells dd to continue until /dev/sda1 is full and noerror is the same as before.

# dd if=/mnt/sdb1/ub_9.10_11.24.09.dump of=/dev/sda1 conv=notrunc,noerror
Posted By: admin
Last Edit: 24 Nov 2009 @ 11:54 AM

EmailPermalinkComments (2)
Tags
Categories: Linux
 06 Oct 2009 @ 7:54 PM 

I’m sure no one noticed, but the server was down for about a week or so. I was getting some disturbing output straight to my console about file io failures that repeated constantly and would not even allow you to work on stuff in the foreground.

The server had a 20gig drive with linux, a 30 gig drive with the web files and a 130gig disk for storage. All these were crammed into a very small computer. Anyway the 20 gig was failing, so I made a backup using dd onto another partition of the 130gig. Then I spent about 3 days trying to get the system to boot from the 130gig hdd to no avail. It seems that something in that drive will just not allow it to boot. I had figured this out before and thats why i was using it for storage. Anyway that caused me to learn a lot about grub and lilo. I just reformatted the 20 gig drive and reinstalled the os on it. I ended up using grub, I also ended up using a different OS.

I tried the latest version of slackware, I figured since i was reinstalling midas well get the latest version. I hated it ! They use the resource heavy KDE, there is no apt-get or yum like functionality. They still have that package system where you have to use pkg-tool in the dir where you have downloaded packages and then go through each one and say yes or no. It is incredibly hard to get those packages, you might know you need a program to do this but unless you know its called progname.ver.somecrazystuff.tar.tz.ver34 good luck finding it on their site. You could also just browse through thousands of packages separated alphabetically and say “maybe this is what i need?” Since I’m also familiar with ubuntu i got the ubuntu server version.

The installation of ubuntu was fast and easy. The boot cd also has a way to load a kernel so you can get in and do stuff like “grub-install” (which does not exist for slackware). After I installed Ubuntu I got my firewall script to work just fine on it. Everything i wanted i just “sudo apt-get install” ed it. Ubuntu also comes with awesome tools like gnu screen and nano, it also has a updated version of vi I had not seen before. And of course the updates in ubuntu are a snap, so i wont end up with a OS that has not been upgraded for 2 years like I did with the version of slackware that crashed.

I did very much like the old version of slackware, version 10 or 11 I think. I loved the way it gave random quotes every time you log in. Also the boot cd allows you to specify a different kernel, which i couldnt figure out how to do with the ubuntu cd. This was very helpful when i had 3 different partitions i was trying to boot. But besides that i’m sticking with ubuntu with xfce4 installed !

Everything is up and running now, obviously. I had backups so most of the stuff got restored. A lot of the stuff got a nice cleaning, i had a lot of junk ! Wordpress turned out to be easy to restore thanks to their backup/restore tools. For my other custom web page (social network site) I opted out of my custom stuff and installed dolphin, the dolphin install took me a few hours then i wrote some scripts to do some crazy stuff with the mysql database so all 500 users from before would just pop up in the totally different social networking software, that was not easy but I was able to do it. I had to also write scripts to resize their photos and store them in directories and all kinds of crazy stuff. If you need to port some site to a dolphin site let me know I can help.

I always have been good with backups, but now I keep a duplicate of the entire linux root disk so i can at any time swap it out and replace it without delay. I’m using the dd for most of that.

I will write about my updated firewall script and the other stuff I did to get the ubuntu system to do all that my slackware system did, just got to get some free time. I’ve also made some diagrams and such, hope to write about that soon.

Today I noticed that I had lost all the work I did over summer (which was a bunch). I was able to find them in old binary files for mysql but the pictures and attachments are all gone for good. Here is what wp told me

   1. Importing post Using IPTABLES on your linux router... (2 comments)
   2. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/simplers232.jpg
   3. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/ttl-rs232-conv-top.jpg
   4. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/ttl-rs232-conv-back.jpg
   5. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/card-reader-conv.gif
   6. Importing post RS-232 to serial Conversion, using 2 transistors... (1 comment)
   7. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/pic-blew-up.jpg
   8. Importing post Blow UP your Pic's...
   9. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/rf-out-backspace-fullshot.jpg
  10. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/rf-out-tab-fullshot.jpg
  11. Importing post SoundCard Oscilloscope...
  12. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/protoboard-02-top.jpg
  13. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/protoboard-02-bottom.jpg
  14. Importing post Protoboard Version 0.2... (2 comments)
  15. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/pic-uart-aa.jpg
  16. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/rs232-a.jpg
  17. Importing post RS232 Revisited... (1 comment)
  18. Importing post Standard Lab Journal Format that I will be using... (1 comment)
  19. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/network-setup.jpg
  20. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/firewall-flow-chart.jpg
  21. Importing post My Linux Firewall Script... (43 comments)
  22. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/rcr-rx-breadboard.jpg
  23. Skipping attachment http://zonemikel.com/wordpress/wp-content/uploads/2009/05/rcr-tx-protoboard.jpg
  24. Importing post Testing RCT-433-AS-TRANSMITTER and RCR-433-RECIVER... (10 comments)
  25. Importing post Ubuntu + VirtualBox + Existing WinXP 64 Hopefully !:... (6 comments)
  26. Importing post Ubuntu 9.04 + Virtual Box (non ose) + usb grayed out... (32 comments)

At least i got the information back and i wont have to start out from scratch when i pick up those projects again. If i find the pictures i will upload them so they show up.

Posted By: admin
Last Edit: 08 Oct 2009 @ 11:37 AM

EmailPermalinkComments (0)
Tags
Categories: General Blogs
 06 Oct 2009 @ 10:55 AM 

I’m so dumb i was still using samba. If your using linux you really dont need samba ! You can set it up using nfs and have a easier more secure method. Its like the file was on your own machine.

This is what i used to do to mount my samba shares in ubuntu.

#!/bin/bash
#pass=$1
echo -n "Password: "
stty -echo
read password
#script to connect to samba drive on server.
smbmount //ip/dir /home/michael/server/ #-o username=zonemikel,password=$password
#example smbmount //192.168.1.200/WebFiles /home/michael/webserver/ -o username=zonemikel,password=$password
echo "connected"
read -p "Press any key to unmount drives. " -n1 -s
smbumount /home/michael/server/
smbumount /home/michael/webserver/
echo "unmounted"

I had to have it un mount or my pc would not shut down right … anyway thats the old way this is the new

sudo mount -t nfs serverName:/mnt/files /home/michael/server

No passwords, it allows only ip addresses from the network to connect. Since I’m using a direct connection from the server to this subnetwork there is no other place for someone to patch in and use that ip, so its relativly secure. If I were using it over a large network i think anyone could change their ip to a “trusted” (/etc/hosts.allow) ip and easily gain acess to your files, but on a home network such as mine with a trusted and un trusted subnetwork this is ok.

Here is the original Link to the instructions
This text below (the remainder of this article) is NOT my writing ! I just want to keep a copy here in case they move their site or something

While most things about Ubuntu work pretty much the way you want/expect the first time, one exception is sharing folders between two computers on the same LAN (”Local Area Network” — in this case, multiple computers in the same house sharing an internet connection via a router). Surprisingly, it’s easier/more intuitive to do this between an Ubuntu computer and a Windows computer! I wish Ubuntu would make a more intuitive, graphical way for non-technical users to do this — though I certainly have fun tinkering with these things and learning more about networking (or what-have-you) as I go.

Through some command-line magic, I’ve gotten my laptop to be able to access the music folder on my desktop — right now I’m playing music on my laptop that’s actually stored on my desktop’s much bigger hard drive. Sweet! How did I manage this?

Say you have two computers, both running Linux (in this case they’re both running Ubuntu and I can’t vouch that this will work on any other distro, but I suspect it would) — the server, which has the folder you want to share on its physical media, and the client, which will connect to the server and access its data.

On the client:
1. In a Terminal window, run

sudo apt-get install nfs-common

— this installs the software you’ll need.
2. Run

ifconfig

to find your IP on the local network; it should look something like

inet addr:192.168.1.101

(If you see more than one instance of “inet addr” in the output of ifconfig, choose the address that doesn’t begin with 127.)

On the server:
3. In a Terminal window, run

sudo apt-get install nfs-kernel-server

4. Edit the

/etc/hosts

file and add a line that looks like this:

neuron 192.168.1.101

where “neuron” is replaced with the hostname or a nickname for your client (in this case, “neuron” is the name of my laptop) and “192.168.1.101″ is replaced with the IP you found in step 2.
5. Test this — in a Terminal, run

ping -c 1 neuron

(or whatever name you used) and see if you get a response. If you get a response like “unknown host”, something is wrong — re-check your work from the previous steps (and check that the two computers are really on the same network!). If you get a response like “… 64 bytes from neuron… 1 packets transmitted, 1 received … ” then everything is hunky-dory so far and you are ready to move on!
6. Edit the

/etc/hosts.allow

file and add a line that looks like this:

ALL: 192.168.1.101

(again, use the IP that you found in Step 2).
7. Edit the

/etc/exports

file and add a line that looks like this:

/home/music 192.168.1.101(rw,sync,subtree_check,no_root_squash)

where again 192… is replaced with the IP from step 2, and “/home/music” is replaced with the full path to the folder you want to share. Note that for some reason it is important that the parenthesized arguments don’t have a space between them.
8. Run

sudo /etc/init.d/nfs-kernel-server restart

9. Run

ifconfig

and get the IP of your server, the same way that you found it for the client.

Back on the client!
10. Edit

/etc/hosts

and add a line like

192.168.1.103 boffin

where “192.168.1.103″ is replaced with the IP of your server (from step 9) and “boffin” is replaced with the hostname/nickname of your server (”boffin” is the name of my desktop).
11.

ping -c 1 boffin

to check that this worked, just like in Step 5.
12. Make a mountpoint for your shared directory — in my case, I used

mkdir /media/boffin-music

13. Mount the shared directory at the mountpoint, like this:

sudo mount -t nfs boffin:/home/music /media/boffin-music

replacing “boffin” with your server’s name, “/home/music” with the location on the server of your shared folder, and “/media/boffin-music” with the mountpoint you created in step 12.
14. Now you should be able to browse to the mountpoint and see your shared files, and open them, and use them. Awesome!

Posted By: admin
Last Edit: 06 Oct 2009 @ 01:41 PM

EmailPermalinkComments (0)
Tags
Categories: Linux, Networking
Change Theme...
  • Users » 5
  • Posts/Pages » 71
  • Comments » 62
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Contact Me



    No Child Pages.

Front



    No Child Pages.