First of all, if you have moved the beginning of the partition, chances are rather high, that you can only wave the filesystem there goodbye. The reason is, that the beginning of a filesystem usually contains a very important data structures (usually called supeblock) without which the data in the filesystem is inaccessible. Maybe some utility exists that could move the superblock and fix the filesystem (because sectors numbers, which are used for data addressing in the end, would change since these are counted from the beginning of the partition), but I would be very cautious about using any such thing. Especially if you intended to use it on a mounted partition.
If you did it on a living system, the kernel still has the old partition table cached and will create a new one on reboot (it can reread it when no partitions are mounted on the device - you can request this e.g. with hdparm -z
). If you still can get the old patition boundaries (sector-exact) somewhere I would recommend to reset it and retry as described below. If you don't have the information any more, there are utilities that try to find out the original partitions boundaries by scanning the disk for superblocks (or probably by checking the kernel cached data).
That said, the correct way to do the resize is:
copy filesystem from /dev/sda3
to /dev/sda1
- either file by file, or with a dump utility, or directly with dd
if the destination is bigger than source with. In the last case, you should extend the filesystem as described later.
fix all important references in the filesystem on /dev/sda1
from /dev/sda3
to /dev/sda1
- this includes:
boot from /dev/sda1
either extend /dev/sda1
to cover /dev/sda2
and /dev/sda3
or repartition the now unused space spanned by those. If extending, use the utility for your filesystem to grow it at the end (for EXT2/3 this would be resize2fs
, for XFS xfs_growfs
etc.).
update /etc/fstab
again if necesary.
Renumbering: fdisk
has fix partition order
(in the extra functionality sub-menu), gdisk
has sort partitions
(in the main menu). Then you have to check /etc/fstab
and possibly also the bootloader configuration again to see whether any intervention is needed.