LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Re-Sizing a File System / Partition (https://www.linuxquestions.org/questions/linux-server-73/re-sizing-a-file-system-partition-933825/)

devUnix 03-10-2012 07:41 PM

Re-Sizing a File System / Partition
 
Hi!


If we re-size (by that I here mean reducing size not increasing) a File System / Partition using utilities, such as parted, then can the data on that partition be lost?

We can reduce the size of an LVM similarly. However, is there any likelihood that the data would not be available after re-sizing the partition?

[GOD]Anck 03-10-2012 08:17 PM

Quote:

Originally Posted by devUnix (Post 4623722)
Hi!


If we re-size (by that I here mean reducing size not increasing) a File System / Partition using utilities, such as parted, then can the data on that partition be lost?

We can reduce the size of an LVM similarly. However, is there any likelihood that the data would not be available after re-sizing the partition?

There is always some risk involved, have backups! I'd say the safest way is to first shrink the filesystem (while it is not mounted) using whatever tool comes with it (resize2fs for ext*) to slightly less than the final intended size, then shrink the underlying device to the intended size, and then grow the filesystem to occupy all of said device.

syg00 03-10-2012 08:18 PM

There is always the potential to lose data.
Read the documentation.

Generally things like [g]parted are safe, but depends on the filesystem. LVM is a real problem.
Best to resize the filesystem using native tools (if available) then the partition.

Best of all is decent backups.

devUnix 03-10-2012 08:38 PM

I have tried increasing the size of a partition / an LVM without any loss to the present data. But, well, this one I just tried using parted's resize command and ended up corrupting the partition and then eventually had to remove it permanently. Well, I am not in trouble. It's a local test VM whose backup I had taken before doing any R&D on it. ;)


All times are GMT -5. The time now is 06:24 PM.