Showing posts with label backup partition table. Show all posts
Showing posts with label backup partition table. Show all posts

Tuesday, July 1, 2008

Live CD From Your In Installation / Running System - Ubuntu - Easy Way

In the previous posts I have shown howto remaster an Ubuntu LiveCd, which could also be used to make a LiveCd from your running system with some minor modifications, but the method I will be showing is fully automatic and effortless, and it works i tested it under ubuntu 8.04 and worked like a charm.

You can also use this, to customize an Ubuntu LiveCd if you install it on your hard drive and them use this method.


First off all you have to get remastersys:

$ wget http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/r/re/remastersys/remastersys_2.0-5_all.deb

$ sudo dpkg -i remastersys_2.0-5_all.deb


Now you just have to use remastersys either in the "Bash Shell" or via its "Gui":


-----------
Bash Sell
-----------

You have basically you have three options:


backup - backs up your system including your /home folder with
your users on it.

dist - omits the /home folder thus making it a distributable cd
that you can give to your friends.

clean - removes the temporary folder that was created, including the
new iso so burn it and copy it elsewhere before you run
"sudo remastersys clean"



If you want to make a LiveCd you choices are either 'backup' or 'dist', I'm going for 'dist':

$ sudo remastersys dist

Now the process starts and you have to do is wait, be sure have enough space in your system because remastersys is going to make /home/remastersys dir and work there.

When it all ends, you have an iso off your LiveCd, that you can burn with K3B or other, at:

/home/remastersys/remastersys/customdist.iso

Now burn it or move it and clean all the temp files remastersys created under /home/remastersys, using the following command:

$ sudo remastersys clean



-----------
Gui
-----------

To run the remastersys gui, which is very basic, just type:

$ sudo remastersys-gui

The gui presents you, with the following options:

Back Complete System including User Data
Make a Distributable copy to share with friends
Modify the remastersys config file to customize options
Remove temporary files
About Remastersys Backup
Quit Remastersys Backup

If you want to make a LiveCd you choices are either 'Back Complete System including User Data' (backup) or 'Make a Distributable copy to share with friends' (dist), I'm going for 'Make a Distributable copy to share with friends'.

Now the process starts and you have to do is wait, be sure have enough space in your system because remastersys is going to make /home/remastersys dir and work there.

When it all ends, you have an iso off your LiveCd, that you can burn with K3B or other, at:

/home/remastersys/remastersys/customdist.iso

Now burn it or move it and clean all the temp files remastersys created under /home/remastersys, execute the remastersys gui once again:

$ sudo remastersys-gui

and chose:

Remove temporary files



Happy LiveCD Making.

Monday, July 2, 2007

Save of a partition table (MBR)

Introduction to partitions


Even if you have only one volume, your hard disk is divided into
partitions. The standard MSDOS voulme label allows to have up to 4
primary partitions. The partition table is stored in the MBR (Master
Boot Record). This area is the first 512 bytes of the physical hard
drive. It also contain some code which will start the operating system,
which can be the bootloader (LILO, grub, ...). If your hard disk is
hda, parimary partitions are hda1, hda2, hda3 and hda4. It's easy to
save to primary partitions table, by copying the MBR.

To get past this limitation of 4 primary partitions, you can
create an extended partition. An extended partition is a primary
partition which contains a lot of partitions. For example, if hda2 is
an extended partition, its logicial partitions will lappear as hda5,
hda6, hda7, ... even if you don't use 4 primary partitions. That's why
you can have an hda5 device, with no hda4. The problem with extended
partition is there is no table we can easily save. The extended
partition contains a linked list. hda5 will point to hda6, hda6 will
point to hda7 and so on. This makes it difficult to save the partition
table of the extended partition.

Partimage can save the data of one partition, but it won't save
your partition table. If you have a major problem with your hard drive,
you may have to restore both the partition table and the data - having
the images of the partitions won't be a lot of help on there own. Which
is why we'll show you how to save the partition image now.



Making a backup of the partition entries

We will save all the partitions entries (both primary and logicial
ones which appear in the extended partition). In this example, we'll be
assuming that hda (the first IDE hard disk) is to be backed up.

First, we will save the MBR with DD (GNU convert and copy)


cd /root
mkdir partition-backup
cd partition-backup
dd if=/dev/hda of=backup-hda.mbr count=1 bs=512

It will produce a very small, but very important file: 512 bytes of data. Now, we will save entries of the extended partitions:


sfdisk -d /dev/hda > backup-hda.sf


sfdisk is a tool provided with the util-linux package.

IMPORTANT: You should now put these files somewhere safe
- copy them to a floppy disk (and take a copy of it!), or burn them
onto a CD. Keep these files safe. Do not leave them on your hard drive
- if there is a problem with th drive, you may not be able to access
these files, and while your partition images won't be wortheless, it
will certainly be a lot harder to restore your data.


Restoring partition entries from the backup


Be careful, restoring is a dangerous action - it can destroy data! First, we will restore the Master Boot Record:


dd if=backup-hda.mbr of=/dev/hda


Then, here is how to restore extended partitions entries:


sfdisk /dev/hda < backup-hda.sf

To finish, you will have to reboot your computer.