Copy Your Linux Install to a Different Partition or Drive
If you need to move your Linux installation to a different hard drive or partition (and keep it working) and your distro uses grub this tech tip is what you need.
To start, get a live CD and boot into it. I prefer Ubuntu for things like this. It has Gparted. Now follow the steps outlined below.
- Mount both your source and destination partitions.
Run this command from a terminal:
$ sudo cp -afv /path/to/source/* /path/to/destinationDon’t forget the asterisk after the source path.
- After the command finishes copying, shut down, remove the source drive, and boot the live CD again.
- Mount your destination drive (or partition).
- Run the command “gksu gedit” (or use nano or vi).
Edit the file /etc/fstab. Change the UUID or device entry with
the mount point / (the root partition) to your new drive.
You can find your new drive’s (or partition’s) UUID with this
$ ls -l /dev/disk/by-uuid/
- Edit the file /boot/grub/menu.lst. Change the UUID of the appropriate entries at the bottom of the file to the new one.
- Run sudo grub.
At the Grub prompt, type:
find /boot/grub/menu.lstThis will tell you what your new drive and partition’s number is. (Something like hd(0,0))
root hd(0,0)but replace "hd(0,0)" with your partition’s number from above.
setup hd(0)but replace "hd(0)" with your drive's number from above. (Omit the comma and the number after it).
That’s it! You should now have a bootable working copy of your source drive on your destination drive! You can use this to move to a different drive, partition, or filesystem.
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
|Trying to Tame the Tablet||May 08, 2013|
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- New Products
- RSS Feeds
- Tech Tip: Really Simple HTTP Server with Python
41 min 7 sec ago
- Automatically updating Guest Additions
1 hour 49 min ago
- I like your topic on android
2 hours 36 min ago
- Reply to comment | Linux Journal
2 hours 57 min ago
- This is the easiest tutorial
9 hours 11 min ago
- Ahh, the Koolaid.
14 hours 50 min ago
- git-annex assistant
20 hours 49 min ago
- direct cable connection
21 hours 12 min ago
- Agreed on AirDroid. With my
21 hours 22 min ago
- I just learned this
21 hours 26 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.