Re: Can I Resize A Partition With dd?

From: John-Paul Stewart (jpstewart_at_sympatico.ca)
Date: 08/24/03


Date: Sun, 24 Aug 2003 15:27:03 -0400

Hank Kingwood wrote:
>
> I modified my /dev/hda3 partition to occupy more physical space with
> fdisk and dd by doing this:
>
> dd if=/dev/hda3 of=<NFS_path>/hda3.img bs=4096
> fdisk /dev/hda
> I resized /dev/hda3 to be bigger
> mkfs.ext3 /dev/hda3
> dd if=<NFS_path>/hda3.img of=/dev/hda3 bs=4096
>
> Everything on the system appears to work. My questions is:
>
> Q1: Would there be any problem with the file system?

Yes, AFAIK. Does 'df' show the total size of the old filesystem or the
new one?

'dd' copies everything bit by bit (including critical filesystem-level
data structures). When you copied the image back, you also copied back
those filesystem data structures (overwriting the new filesystem you
made with mkfs) from the smaller filesystem. You now have a filesystem
smaller than the partition it resides on.

You either need to use 'cp -a' or 'tar' or some such to copy only the
data (as opposed to the complete image you used) *or* you need to find a
way to resize the ext3 filesystem. 'resize2fs' may work on your ext3
partition. GNU 'parted' may also be able to resize the filesystem.



Relevant Pages

  • Re: Can I Resize A Partition With dd?
    ... Does 'df' show the total size of the old filesystem or the ... those filesystem data structures (overwriting the new filesystem you ... way to resize the ext3 filesystem. ... GNU 'parted' may also be able to resize the filesystem. ...
    (comp.os.linux.setup)
  • Re: soft update vs journaling?
    ... >> filesystem, but the problem is how many filesystem data structures ... >> arbitrary disk block?" ... > fragmenting the allocation bitmap, catalog file, etc, such that each ... I _believe_ you could use such data structures to ...
    (Linux-Kernel)
  • [TOMOYO #7 28/30] Filesystem part of tamper-proof device filesystem.
    ... there are hooks for checking filename-attribute pairs. ... * This filesystem is developed using the ramfs implementation. ... * how virtual filesystems can be written. ... * need to implement any data structures of its own ...
    (Linux-Kernel)
  • Re: Laptop mode causing writes to wrong sectors?
    ... > filesystem corruptions. ... > ext3 bug because the first corruption I did observe happened shortly ... I think that your resize sequence is missing an e2fsck -f ... About the laptop mode hypothesis: I think it's just a coincidence. ...
    (Linux-Kernel)
  • Re: [Ext2-devel] [RFC 0/13] extents and 48bit ext3
    ... Now resize blkdev formatted for size 500MB to 500GB, ... the default inode ratio and blocksize is different for ... a filesystem *far* larger than 512megs. ... LVM sized to be 2 gigs and resize it to 5 gigs. ...
    (Linux-Kernel)