bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parted, fixed size partitions, copying and resizing


From: John Gilmore
Subject: Parted, fixed size partitions, copying and resizing
Date: Sun, 15 Aug 2004 23:33:40 -0700

I ran across an interesting problem today.

I do backups onto hard drives, removing one periodically and replacing it
with a fresh drive.  The backups are essentially "dump | bzip2" for
various file systems.

The time came when I wanted to make a second copy of a 250GB backup
drive full of those dump files.  Preferably an image copy.  So I
plugged two removable 250GB drives into the same machine, and tried to
use parted's "cp" command to copy one to the other.

The two drives were from different manufacturers, so each one's idea
of the size of a 250GB drive was different.  One had 239372.437 mbytes
(according to parted 1.4.24), the other had less.  I had made a single
primary partition on each drive, containing the entire drive except
the label.  Copying the data didn't work because the drive I was
copying from was slightly larger than the drive I was copying to.
(And parted nicely pointed out that it has no code for copying ext2
file systems.  Though it can image-copy and then resize-in-place,
that only works if the new filesystem is larger than the old.)

Well, I thought, I know how to fix this.  It violates the principle of
keeping your original backup read-only, but the *%$&#$& disk drives
don't come with write protect jumpers anyway.  I can resize *all* of
the backup partitions (on various removable drives) to a size that's
250,000,000,000 bytes long.  Whatever minor stuff is left at the end
of the drive I don't care about.  Then I'll be able to copy any
partition to any other one -- with dd or parted or whatever.

Well, that resulted in several problems.  Luckily it didn't corrupt my
original backup drive.  But parted actually makes partitions of slightly
different sizes on the drives -- and there appears to be no way to tell
it to "make me a partition of 250,000,000,000 bytes, dammit!"  I suspect
that it's "rounding" to the nearest "cylinder" boundary.  Of course we
all know that "cylinders" are a useless fiction in modern disk drives,
only placed on the earth to snare unwary sysadmins and to trick ancient
BIOSes.  (And yes, I know I have to subtract off the label size to keep
the entire thing within 250,000,000,000 bytes.)

So, is it actually possible (for me) to standardize on a partition
size, and have parted create partitions of exactly that size, no matter
what the "geometry" of the drive?  If not, why not?

Second problem I caused was by trying to resize a backup partition
that was installed on my main server, as the current backup partition
(to this common size of 250,000,000,000 bytes).  This was a slight
shrink of the partition.  I unmounted it before trying to resize, but
didn't remove the ext3 filesystem journal.  This, or something else,
caused parted-1.4.24 to corrupt the filesystem while resizing it.  The
current filesystem contains inodes and pointers outside the partition.
fsck can't clean up the partition.  I'm afraid to run parted "resize"
again on it.  debugfs won't open it.  The kernel is happy to mount it
read-only, and I can get the data out of it (I don't know what data is
good v. bad, but most of the partition was free space).

Any suggestions?

        John




reply via email to

[Prev in Thread] Current Thread [Next in Thread]