Discussion:
Trouble resizing partitions
Aidan Gauland
2011-07-21 09:16:54 UTC
Permalink
Hello, fellow penguins!

I am trying to resize an encrypted partition on my hard disk, but no
program I have tried will cooperate. parted complains that it "could
not detect file system," fdisk seems incapable of resizing partitions,
and `cfdisk /dev/sda` aborts with "FATAL ERROR: Bad primary partition 1:
Partition ends in the final partial cylinder". I can still boot into my
system and the partition table looks sane, so I have no idea what cfdisk
is complaining about.

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002f08e

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 499711 248832 83 Linux
/dev/sda2 501758 625141759 312320001 5 Extended
/dev/sda5 501760 625141759 312320000 83 Linux

Can anyone offer any advice? I'm stuck. It's probably not related to
the problem, but I am trying to shrink sda5, which is an encrypted
partition with LVM on top. I have already shrunk the contents of sda5
and now only need to shrink the entries (for sda5 and sda2) in the
partition table. (If you're wondering why I have an extended partition,
it's only because my partitioning scheme was set up by the Debian
(squeeze) installer.)

Thanks,
Aidan

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Jim Cheetham
2011-07-22 03:03:21 UTC
Permalink
On Thu, Jul 21, 2011 at 9:16 PM, Aidan Gauland
Post by Aidan Gauland
I am trying to resize an encrypted partition on my hard disk, but no
program I have tried will cooperate.
Give up :-) It won't work. That's why you encrypted the partition, isn't it?
Post by Aidan Gauland
 parted complains that it "could
not detect file system,"
Well, did you provide it with the decryption key, so that it could
detect what type of data is in there? No, you didn't (because it isn't
supported. And also I guess you don't know what the decryption key
is?)
Post by Aidan Gauland
fdisk seems incapable of resizing partitions,
Wrong. fdisk can "resize" a partition just fine (they all can, bu
"deleting it and recreating it differently") but what it can't do is
"also resize your filesystem that is currently using the partition".
Post by Aidan Gauland
Partition ends in the final partial cylinder".  I can still boot into my
system and the partition table looks sane, so I have no idea what cfdisk
is complaining about.
It is complaining about "correctness" and doesn't understand what BIOS
and/or OS you are using. Your machine can cope, so don't worry.
Post by Aidan Gauland
Can anyone offer any advice?  I'm stuck.  It's probably not related to
the problem, but I am trying to shrink sda5, which is an encrypted
partition with LVM on top.  I have already shrunk the contents of sda5
and now only need to shrink the entries (for sda5 and sda2) in the
partition table.  (If you're wondering why I have an extended partition,
it's only because my partitioning scheme was set up by the Debian
(squeeze) installer.)
If you are *confident* that you know which blocks are being used, then
just use fdisk to delete the partition as it stands, then create a new
one with the correct range/size.

After all, the "partition table" is just an index, not the actual
thing. Deleting a partition doesn't affect any of the data actually
stored on the disk.

-jim

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug

Continue reading on narkive:
Loading...