If I delete a partition with step 1 from Andreas solution (https://serverfault.com/questions/861517/centos-7-extend-partition-with-unallocated-space), and then I create new one, bigger partition, do I keep my data from this partition or they lost?

Now issue d followed by 2 to remove the second partition. Issue n to create a new second partition.


As the author of the earlier answer notes, the critical step to protecting your data is to

Make sure the start equals the start of the partition table you printed earlier.

As long as you do that, the OS won't notice when you delete the partition, because it's using the memory-cached partition table that it set up at boot time (hence the error when writing the new partition table). When you reboot, the OS will find the data where it left it, because the new partition begins in exactly the same place the old one did. Sure, it ends a lot further on than it used to, but moving the end of a partition isn't a problem in the same way that moving the beginning is - which is to say, fatal for your data.

However, as with all such exercises, you should both take and test a full backup before doing any of this on live data.

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.