Partition Management Software for Linux?
Chris Siebenmann is curious about the following:
"As part of thinking about disaster recovery for
our Linux machines, I'm looking at ways to back
up and restore the partition tables of our disks,
because it's about the only piece of data about
the system that isn't backed up. We've got
printouts of the partitioning details (via
'fdisk -l' and 'cfdisk -P') but I'd rather not go through the error-prone bit
of typing them in again to partition new disks.
Is there any program that saves and restores
partition tables? Better yet, is there one that
saves partition tables in some reasonably
abstract levels, describing the size of the
partitions and how they're structured in an
editable form, with a restoration program that
can cope with a not-completely-identical disk
to restore them onto? (Such a program would be
a useful part of an automated Linux setup and
install system, too.)"
There is some partitioning info and resource links in the Partitioning page of Gary's Encyclopedia.
I just saw a newly available partitioning program within the last couple weeks (at LWN?), but I failed to snag it. Dang.
Look at sfdisk. It's part of util-linux, and should be standard on all Linux distributions.
man dd ought to get you on your way.
I would also like to see a non-interactive mode
of fdisk where I can partition a disk from a script w/o using expect or so. Ie reading the existing table and re-writing it from a text file similar to BSD would be very nice.
If you have any experience with AIX, you will know what a "mksysb" is. This is a system backup which stores as the first file in the backup the complete LOGICAL disk "partition" information. Since you can boot from tapes on RS/6000 machines, you can do a bare-metal restore from tape, and it creates all of the "partitions"/filesystems for you, and restores all of the files too. Of course, AIX uses a logical volume manager, so the concept of a "partition" isn't quite the same. However, an LVM implementation for Linux is available already (http://linux.msede.com/lvm/), so check it out too. My nascent idea is to make something like mksysb on Linux with LVM, so you can install straight from tape backup (with a boot floppy I guess) and have it set up partitions for you already, like AIX.
This software is awesome. It resizes, moves, copies, and checks FAT, FAT32, NTFS, HPFS, and my personal favorite Linux Ext2 and Linux Swap.
That program stuffed the file allocation table of my fat32 partition. I had to re-create the partition since everything was cross-linked.
Hello
If you really want to save the partition table,
all you've got to do is save the very first
sector of your hard-drive using DD.
To restore the partition, just copy it back
(also using DD). It might be handy to have
linux on floppies just in case you're stuck
with a dead system.
I believe you should think about the uses of
such a thing. Having a copy of your partition
may be handy if you lose your partition sector
(it happens, sometimes), but saving a partition
table in one geometry and restoring it on
another may be messy. Linux only uses the
"relative sector" count, but anyway I don't
believe it's wise to change the disk and keep
the old partition table.
As for "changing the partition" on the fly,
well, I think it would *rule* but it's very
complicated. Think of your underlying file
system. It will have to be changed too.
Files will have to be relocated and things
like that. In the future, I hope Linux will
have something like LVM (Logical Volume
Manager) from HP, but in the meantime, It's
my opinion that logical backups are the best
way to protect yourself against failures.
In the event of a catastrophe, all you have
to do is reinstall the same version of Linux
(usually a quick task) and restore all of your
files from the tape
Hope it helps
Paga