How to clone your bootable Ubuntu install to another drive

clone.jpgIf you’ve ever wanted to completely clone your Ubuntu install, with all of the tweaks, files you’ve downloaded and changes you’ve made to it, there’s a fairly simple way to do this. What you will learn in this ArsGeek tutorial is great if you want a complete backup, or if you’re looking to move your system to a newer (read: bigger, faster, stronger) hard drive or even just to clone your install to other business machines with the same hardware.

We’ll be using the terminal (Applications-> Accessories-> Terminal) and the dd command to do this. You’ll also need to have your second disk up and running when we get going. You can either have it installed and mounted internally or use an external disk enclosure and USB or Firewire. (Note: Doing this via USB 1 will be excruciatingly slow!)

You’ll also want to either be cloning your hard drive to one of the exact same size, or if you have a larger disk, make a partition of the same size on it and clone to that. Then, use an Ubuntu liveCD to change the partition size (System-> Administration-> Partition Editor). Lastly, you’ll need a Ubuntu LiveCD.

On to the good stuff. Got both disks plugged in? Good! Now you’ll need to figure out which disk you are copying from and which disk you are copying too. In your terminal, type:
df -h
Look first for the partition that’s mounted at root, or ‘/’. Here’s what my root partition looks like.
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 71G 46G 22G 68% /

If you’re using a SATA drive it will appear like that. IDE should be /dev/hda1. See that slash below the Mounted on? That’s the root drive.

Now you’ve got to locate the drive you’re copying too. The same df -h command will do the trick. Look for another disk mounted on /dev/****. If you’re not sure what you’re looking for, first run the df -h command without your second disk mounted. Then plug the 2nd disk in (be sure to shut down if you’re doing this inside your machine and not via USB or FireWire) and run the df -h command again. The newest partition that appears is what you’re looking for!

So if your current root partition is /dev/sda1 and the partition you’re going to copy to is /dev/sdb1 (a USB mounted drive) here’s the command you’ll need to type in your terminal:

sudo dd if=/dev/sda1 of=/dev/sdb1

Replace with the correct paths for your drives if they differ. It’s going to take a while, so grab a book or start up a movie. Maybe go to bed.

Once it’s complete, you’ve got yourself a brand new copy of your current Ubuntu install. You’re not quite done yet though. Now you’ve got to install Grub on your new disk so you can boot from it. Make sure your new disk is attached to your machine and your old disk is unplugged and boot into the Ubuntu LiveCD.

Once your machine boots up, open up a terminal session and type:
sudo grub
Grub will launch and give you the grub> prompt. Here, type:
find /boot/grub/stage1
You should see something come back that looks like hd(0,0). Jot that down, you’ll need it in a second.

Now, still in the grub> prompt, type:
root hd(0,0)
You’ll put in whatever result you go above – it may be different than hd(0,0).

Once that completes, type:
setup (hd0)
Even if you got a result that differs from hd(0,0) above.

Type:
quit
And you’re out of grub. Restart your machine, removing the LiveCD and you should be up and running on your new hard drive. You may also encounter a problem on your first boot where the system will try to scan your hard drive for bad sectors. If that fails, you’ll find yourself in a root terminal session. Just type:
fsck
Let the disk check finish and you should be good to go.

Share

How to fix your Windows MBR with an Ubuntu liveCD

windows-mbr.jpgSomething happen to a windows Master Boot Record (MBR) that you’re responsible for? Want a very quick, very easy way to restore it with nothing but your craft, native intelligence and a liveCD?

Be cautious here – you’re working with your disks in a very direct manner. If you don’t have everything backed up or are unsure of anything, you may want to wait until you have a standard Windows CD/DVD.

Boot into your Ubuntu LiveCD on the offending machine. Once Ubuntu starts up, go to System -> Administration -> Software Sources and enable (by checking it off) the Universal repository.

Now, open a terminal session (Applications -> Accessories -> Terminal) and type the following:
sudo apt-get install ms-sys
ms-sys is a program used to write Microsoft compatible boot records.

Now you’ll need to figure out what partition is the one hosting your Windows operating system. Back in the command line, type:
sudo fdisk -l
That will list the available partitions. You’re looking for a partition that says something like
/dev/sda1 1 9327 74919096 83 NTFS
The two important bits are the ‘/dev/sda1‘ which is the partition itself and the ‘NTFS‘ which tells us it’s a Windows formatted partition. So your Windows partition exists on your drive sda and it’s partition 1. The MBR for drive sda (assuming you boot into windows using it’s native boot loader) is what you want to repair.

We want to fix the MBR on /dev/sda. To do so, type:
sudo ms-sys -m /dev/sda
You’ll want to change the ’sda’ bit if your results from ‘fdisk -l‘ are different. If for instance your windows install is on sdb or hda.

Once you do that, reboot the machine, removing the LiveCD from the drive and Windows should come back to you.

Sure, you could do this by inserting the correct Windows CD and booting into repair mode from it – but I find the Ubuntu way a bit faster and I’m more likely to have an Ubuntu LiveCD on me than a Windows CD. For alternative ways make sure to search through the posts on our homepage.

Share

How to find your UUID’s for devices in Ubuntu (and other Debian based distros)

uuid.jpgHave a burning urge to discover the UUID’s of your disk partitions? Run Ubuntu or some other Debian based distro like maybe Debian? Well have I got the article for you friend! Here it is, two easy steps to discovering your UUID – and the best part? For two steps I’ll give you two different ways to get that pesky UUID on your screen.

But first, what exactly is a UUID? From Wikipedia we see that a UUID is a Universally Unique Identifier. “The intent of UUIDs is to enable distributed systems to uniquely identify information without significant central coordination. Thus, anyone can create a UUID and use it to identify something with reasonable confidence that the identifier will never be unintentionally used by anyone for anything else.”

For a little more trivia: A UUID is a 16-byte (128-bit) number. The number of theoretically possible UUIDs is therefore 216*8 = 2128 = 25616 or about 3.4 × 1038. This means that 1 trillion UUIDs would have to be created every nanosecond for 10 billion years to exhaust the number of UUIDs. That’s a lot of UUIDs.


These unique ID’s are used by Ubuntu to identify your various partitions for the system. So if you do a quick
cat /etc/fstab
You should see at least one, probably two and possibly more UUID’s in there. One for your primary partition and one for your swap partition, plus more if you have any removable devices, other drives or other partitions around. It will look something like UUID=1c9e4ae2-0ddc-4e3c-8758-4cdd6c90407a.

So how do you discover just what partition belongs to which UUID? Open up a terminal session (Applications -> Accessories -> Terminal) and type the following:
blkid
On my system, the output is as follows:
/dev/sda1: UUID=”1c9e4ae2-0ddc-4e3c-8758-4cdd6c90407a” SEC_TYPE=”ext2″ TYPE=”ext3″
/dev/sda5: UUID=”a647ea33-74ee-4123-84bf-7edc32e2e39b” TYPE=”swap”

So sda1 (my primary partition) and sda5 (my swap partition) are identified.

Or, your could type:
ls -l /dev/disk/by-uuid
and see something like this:
lrwxrwxrwx 1 root root 10 2008-01-02 08:26 1c9e4ae2-0ddc-4e3c-8758-4cdd6c90407a -> ../../sda1
lrwxrwxrwx 1 root root 10 2008-01-02 08:26 a647ea33-74ee-4123-84bf-7edc32e2e39b -> ../../sda5

There you can get the UUID and also see who owns the partitions, when they were last touched, their permissions and finally, what they’re called (sda1 and sda5 in this case).

If you’re trying to pin down which UUID is associated with a particular thing, such as your root partition, you can cat /etc/fstab and look for the UUID associated with the mount point “/“.

Share

ArsGeek reviews the Neuros OSD

osd-9withaccessories.JPG

The first two observations I made when I opened my Neuros OSD were that the unit was a lot smaller than I was expecting (about five and a half inches by five and a half inches in size) and that it looked nice. This was no flat looking boxy apparatus, nor was it a standard component. It was curved, it was sleek, black and more aerodynamic than any other DVR I’ve come across. When I saw it, I immediately decide to publish this review on Arsgeek blog.

I liked the size and the look immediately. Not only was this thing slick looking, but I could easily grab the RCA cables and the Neuros and bring it over to a friends house to watch whatever I’d recorded.

neuros-osd.jpg

There are a few things that are fundamentally different about this video recorder which may take a little getting used to. First, this product is open. Not open as in the wind blows through it, but open as in anyone can hack around with the firmware, making changes and if they are for the better, giving them to the community. The second change is that this recorder really doesn’t have any storage of it’s own to record to. You’ll need to provide storage in the form of one of the many popular memory cards (complete list below), a USB drive or your networked share.

Taking the Neuros out of the box another thing became apparent. This would be an easy device to set up. You plug two sets of RCA cables into it and plug them into your source (digital cable in my case) and your output (a TV set with me). I plugged the unit in, stuck a 4 GB USB flash drive into the side of it and using the handy remote I turned it on. I set the playback device as Television, the recording device to my USB drive, the quality to normal and started recording. A half hour later I had a full television show recorded on my USB drive. Every port, every slot and every plug is clearly labeled in nice, white lettering. That’s great as well.

I took the Neuros out of my living room and plugged it into the bedroom television along with my USB drive and tested the playback. The quality wasn’t amazing but it was certainly good enough. In fast panning shots I noticed a bit of degradation but on the whole it’s not noticeable if you’re watching a sitcom or just about anything other than sports. You can also select different quality levels – recording at a higher level produces larger files but better frame rate and clearer images.

neuros-inout.jpg

With the way storage is going right now, you can easily obtain a 4 GB SD card and pop it into the Neuros for easy recording. Need more storage and want to compete with other devices, not a problem if you have an external USB drive. You’ll need to plug another device in (the drive) but it’s certainly feasible to easily attach 300GB worth of storage.

Something interesting I was able to do was transfer an DivX file from my Archos 605 and pop it onto my USB drive. From there I could play it back via the Neuros without problem. This little device handles an incredible range of formats for video, audio and even image playback. I love that it plays .ogg files – this is my first device other than my Linux computers that supports Ogg Vorbis.

The interface on the Neuros is not the slickest I’ve seen but it’s also still under development. With each new firmware release the interface changes for the better. I enjoy the IR device that when placed over the IR receiver on my cable box can change the channel for me. It’s nice to be able to set up the Neuros to record several shows on different channels and then let the box do the channel changing for me. The Neuros is very easy to use, as simple as any device out there and is a fantastic example of Open Source in action.

neuros-remote.jpg

This product can really be as powerful as you want it to be. If you’re an average home user, you pop an SD card into it and record content for as long as your storage holds out. If you’re a little more advanced, you connect it to your network, update the firmware (or download the firmware to your local PC and put it on an external drive to connect to the Neuros), record video to play directly on your PSP and stream video over your network. If you’re an advanced user and hacker, well you can change the way the Neuros works and make the experience better for everyone.

Pros: This device will record from just about anywhere, play on just about anything and use just about every format out there. Really, you won’t find more flexibility than here. It’s also open which I like on a very basic level. The firmware is constantly changing and making this product better. You can make it as simple or as complex as you’d like it to be. Everything you need to start recording, from the Neuros to the cables to batteries for the remote is included in the box. It’s not horribly expensive and it looks like a sports car.

Cons: In terms of user interface, there is still a bit to be done. Several times my unit froze up on my and had to be power cycled to get it back. I’d love to see a nice program guide for a more TiVo like interface. Wireless would also be great. And even though it’s listed in the pros, one con is that the firmware is constantly being updated to improve the user experience. If you’re not one to have this unit connected to your network at all times (like say, my parents) then you’ll never get the newest updates unless I show up at your house and plug it in for you.

At $229.00, the Neuros OSD won’t break the bank and will give you a full feature, take anywhere, record anything on anything and play on just about everything device. You will have to spend more money on storage if you don’t have anything laying about. With the price of flash memory coming down and the capacity going up, it won’t be long until you’ll be able to pop 30GB of USB flash memory into this box for less than the price of the box itself. I’d love to see S-video out on this, as well as wireless connectivity. Another cable snaking across the floor is not something I’m anxious to have. I’m interested to know if the Eye-Fi wireless SD card would work well with this.

For me, I love fooling around with my Neuros. If you’re at all technologically inclined, you’ll love it too.

neuros-storage.jpg

Video Standard

* Compatible with NTSC, Pal and Secam (input only) standards

Video Recording

* ISO Standard MPEG-4 SP encoding (MP4, ASF)
* QVGA (320×240) @30fps with AAC-LC/MP3/G.726 audio for smartphones, PSP™, iPod™, iPhone™ and PDA’s.
* VGA setting (640×480) @30fps for PC, TV playback.

Video Player

* MPEG-4 SP with MP3 audio, 30fps up to D1 resolution (720×480)
* Quicktime 6
* MPEG-4 AAC-LC stereo
* MP4 format at up to D1 resolution
* H.263 with MP3 audio
* FLV (for Playback of YouTube videos)
* ASF
* AVI (including Divx and Xvid)
* MP4
* WMV (up to QVGA)
* MOV
* MPG
* MPEG

You can also see a more detailed table of supported video formats for playback.

YouTube browser

* Watch YouTube videos on your TV
* Search the entire Youtube library using keywords
* build a list with all your favorite videos

Photo Viewer

* JPEG decoder (baseline up to 32M pixel)
* BMP
* GIF (nonanimated)
* Thumbnail view
* Zoom in/out (2x, 4x)

Audio Player

* Stereo MP3/WMA @ 30-320kbps (CBR & VBR)
* Ogg Vorbis
* FLAC
* WAV
* Stereo MPEG-4 AAC-LC
* G.726

Features

* Schedule (timer) recording
* Customizable slide shows
* One-click record
* IR Blaster to control your set-top box
* Run 3rd party applications

USB Host

* Record to and playback content from any USB mass storage device

Ethernet

* Connect to your network
* Save recordings to network storage
* UPnP support
* Stream Audio/Video from Internet
* Download multimedia content from Internet
* Connect to Windows Networks (Samba client support)

Complete System Includes

* Standard A/V RCA Interface Cables (European units also contain SCART adapters)
* 110-240V AC/DC Power Supply
* Stand
* IR Blaster
* Remote Control
* Abbreviated Users Manual

Dimensions and Weight

* 14 x 14 x 3.2 cm (5.5 x 5.5 x 1.25 inches)
* Weight 230g (8oz)

Upgradeability

* System updates and 3rd party applications available at www.neurostechnology.com/support/
* Automatic built-in software update

Storage Card Compatibility

* Memory Stick: Duo and Pro Duo
* Compact Flash: Type I and Type II
* Microdrives with CF type II interface
* Secure Digital (SD)
* Multi Media Card (MMC)
* USB thumbdrives
* External Hard Drives

Share

Get USB devices mounted on your Virtualbox XP machine in Gutsy (Ubuntu 7.10)

vbox.pngThere’s nothing more frustrating than not being able to mount your USB devices in your virtual machines. Well, maybe there are lots of things that are more frustrating but this morning my inability to do something that should be simple, easy and fun was driving me nuts.

So I figured out how to do it and decided to share this software solution on Arsgeek. It’s not terribly pretty but here’s what you need to do.

First, Gutsy got rid of the previous versions of Ubuntu’s way of handling USB mounts by not using USBFS anymore. Doh. That’s an issue for Virtualbox and your virtual XP installs. So you’ll need to download and install the latest Vbox release, 1.5.2. Click on that link to download the .deb file. Save it on your desktop and then double click on it to install it.

For a quick and easy tutorial on using Virtualbox and installing a virtual XP instance, see UbuntuGeek.

Once you have your virtual XP machine running on your Gutsy host, it’s time to do a wee bit of hacking. Turn of your XP instance and let’s roll up our sleeves and get to work.


First, open a terminal session (Applications-> Accessories-> Terminal) and type in the following to edit a script file:
gksudo gedit /etc/init.d/mountdevsubfs.sh
Once you’ve got that open in Gedit, type CTRL-F to search for a string. Search for ‘magic’ (sans quotes).

That should bring you to this:
#
# Magic to make /proc/bus/usb work
#
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount –rbind /dev/bus/usb /proc/bus/usb

All those pound signs are comments. Remove them from the last four lines so you end up with this:
#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Save the file and exit Gedit. Round one goes to the user!

Now we’re going to create a group called usbusers. Go to System-> Administration-> Users and Groups. Type in your password and then click the Manage Groups button. From there click the Add Group button and name it usbusers. Check off your username below. Exit these windows and round two goes to us.

groups.png

Now we’ve got to change a file in udev. So, let’s gedit it and gedit over with. I’ll apologize for the bad jokes in a later post.
gksu gedit /etc/udev/rules.d/40-permissions.rules
Again, CTRL-F to bring up the search dialog and search for ‘usbfs replacement’ (again, sans quotes). Once you find it, you should be looking at this:
USB devices (usbfs replacement)
SUBSYSTEM==”usb_device”, MODE=”0664″

You’ll want to change it to this:
# USB devices (usbfs replacement)
SUBSYSTEM==”usb_device”, GROUP=”usbusers”, MODE=”0664″

Save your file and exit out of Gedit.

Now, the last bit of hackery which may or may not be required for you. It was for me. We’re going to add a mount to /etc/fstab for usb devices using usbfs.
gksudo gedit /etc/fstab
At the bottom, add the following line:
none /proc/bus/usb usbfs devgid=46,devmode=664 0 0
Save the file and exit Gedit. Phew! Now, the easiest way to get all of these changes working on your system is to restart it. So go ahead and do that and then I’ll see you back here in a few.

Back? Great. Time to plug in your USB device, whether it’s a thumb drive, an iPod or something else, plug it in and let Ubuntu detect it.

Now, we’re going to open up Virtualbox and make some changes to your XP machine BEFORE you start it up. So go to Applications-> System Tools-> Virtualbox and get it started up.

Highlight your XP machine (if it’s not the only instance of a virtual machine) and click the Settings button at the top of Virtualbox. You should now have a USB option on the left hand side of your settings. Click the add icon on the right hand side (see the pic below) and select the device from the list. In my example, it’s a 512MB memory key. Now click the Okay button.

vboxaddusb.png

Start up your virtual XP machine and you will see a notice pop up courtesy of Ubuntu about unsafe device removal. Nod your head sagely and let’s continue on. Once XP is up and running, it should automatically detect the new USB device, and do it’s best to install it. With my memory key, it was as simple as turning the virtual XP machine on and letting XP take care of it.

You may have to go to the Devices menu on your virtual machine (once it starts up) select USB Devices and then uncheck whatever it is you’re trying to mount. Repeat the process, this time checking it off and it should mount if it didn’t automatically.

Share

Ubuntu getting Xorg.conf GUI

Remember the good old days when to change a screen resolution or driver, you had to edit xorg.conf or reconfigure X.org? Those fine times are now over, or they will be, with the release of Ubuntu 7.10. As of an update from a few days ago, users are now able to access a graphical user interface for editing xorg.conf and it’s about time!

Share