I was wondering how you could safely free up space in front of a partition using command line tools such as fdisk or resize2fs.

I know it's possible to do this with gparted, but that is not available for the current situation I have (No GUI). I also know it's possible to free up space in front of a partition with fdisk by setting starting block at x, but this doesn't move any data already sitting there, and destroys the signature / metadata / other data.

I need to free up 2048 sectors (1 MiB) in front of root partition sitting at /dev/sda1

Does anyone know how to do this?

  • That seems to be quite an unusual situation. Any modern partitioning tool should have set the first partition on disk to start at block #2048 already, if this is a MBR-partitioned disk. Such free space before the first partition is unusable except for boot loaders like the i386-pc version of GRUB. But if you have a GPT-partitioned disk, there will be parts of the GPT partition table within that range, and the recommended way to install a BIOS-style bootloader is to create a biosboot partition instead.
    – telcoM
    Aug 8, 2021 at 6:34
  • @telcoM It's to convert a disk filesystem over to LVM. I do not believe you are able to set the start sector to 0 are you?
    – Typewar
    Aug 8, 2021 at 11:14
  • So your goal is to convert a filesystem-on-partition to a filesystem-on-LVM? Are there any other existing partitions on the disk (that you wish to keep)? If it's a non-bootable disk, you could perhaps put the LVM PV header to /dev/sda and make it a whole-disk LVM PV. Unless the disk was partitioned with a very old fdisk in a DOS-compatible mode, the PV header should fit nicely in place of the MBR + the gap before the first partition. Much the same with GPT partitioning, but you'll need to invalidate the backup GPT at the end of disk too.
    – telcoM
    Aug 8, 2021 at 11:37
  • @telcoM There is 2 partitions after /dev/sda1. I have converted an existing ext4 system to LVM before and it needed 2048 sectors in front of the main partition, are you saying there is another way to do this ?
    – Typewar
    Aug 8, 2021 at 13:58
  • If there was only 1 partition, then you would have got the space by removing the partition table entirely and making /dev/sda be your LVM PV instead of /dev/sda1 you currently have. But as there are other partitions on the disk, that trick won't be applicable. (well it might be possible to convert all the partitions to LVM LVs at once but that would be extremely tricky and dangerous.)
    – telcoM
    Aug 8, 2021 at 14:19

1 Answer 1


1M is within the round off size to make partitions aligned. You might get lucky and there might already be that much space somewhere.

Unfortuantely, gparted is the only common tool that can shift a partition backwards to an overlapping range.

Alternatives would be to copy it to another disk, or copy it to a non-overlapping later porton of the disk and then back.

However, I would never consider moving data to an overlapping space to be safe, as it is almost unrecoverable if the process is interrupted in the middle or the disk develops bad blocks during the copy operation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .