1

I am trying to resize home partition (after i made the swap partition smaller) in debian 10. Resizing swap partition was easy, to do this i use these commands :

swapoff -a
fdisk /dev/sda

After deleting swap partition and making it smaller with fdisk i used these commands :

mkswap /dev/sda2
blkid -s UUID -o value /dev/sda2 >> /etc/fstab 

Edited /etc/fstab and put that code into its right location. And after that :

swapon -a

Checked swap partition with free. After that time to resize home partition with live cd with debian un run these commands :

fdisk /dev/sda

Deleted and remade the partition in left space and write changes to disk but when i run this command :

e2fsck -f /dev/sda3

It gives me this error :

error it gives me after i run the e2fsck command

So how can i fix it ?

  • Can you add command used to create that new $HOME partition? – mattia.b89 Jun 21 '20 at 10:45
  • @mattia.b89 I Used fdisk /dev/sda to enter in partition tool and then d to delete old partition, n to create new one with remaining space and then w to write it, everything worked fine at this stage. – Zeth Jun 21 '20 at 10:49
1

From your device-numbering I understand that the home partition is after the swap partition. That means that you have extended the home partition at the beginning. That makes the data in the superblock mostly invalid.

As a general rule, you can only extend file systems at the end, not at the beginning.

If you did make a backup, now is the time to use that backup. Re-create a filesystem on /dev/sda3 and restore the backup.

If you did not make a backup, consider this a lesson why you must make backups before you change file systems or partitions. Your best bet would to resize /dev/sda3 to its original size (i.e. original beginning sector) and run the fsck on it. Then do a complete backup, make the home partition again what you want it to be, re-initialise the filesystem with mkfs.ext4 and restore the backup.

parted or gparted have a "move" command that allows you to move a partition, but I have no experience in moving partitions that might overlap.

  • it was in a virtual machine with only a test file... it wasn't on live system, so i gues there is no way of resizing home partition ? – Zeth Jun 21 '20 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.