-   Linux - Newbie (
-   -   why when i change the partition table the data above stays intact? (

jzoudavy 02-27-2017 04:23 PM

why when i change the partition table the data above stays intact?
Hi all

I got this ubuntu 16.04 VM that I am learning about gdisk on. I created a 1G img file and mounted it on a folder and it works. I can write to the folders and read etc.

Then I decided to change the partition block size from 2M to 4M just for kicks. I had expected that to cause problems such as data loss or corruption. But I can still read and write from my test files. I thought since partition is how the blocks on the disk is allocated, but if I change that, shouldn't that negatively affect the files on top?


michaelk 02-27-2017 06:04 PM

How did you create the image file, what filesystem did you format it as and how did you change the partition block size?

rknichols 02-27-2017 06:52 PM

Where and how did you change the "partition block size"? There is no such field in either the GUID or legacy MBR partition table, so what did you change?

jzoudavy 02-27-2017 09:36 PM


I did the following:


dd if=/dev/zero of=test.img bs=1M count=1000
mkfs.ext3 test.img
fdisk test.img

michaelk 02-28-2017 03:19 AM

No, the bs option specifies the number of bytes the dd command reads/writes at a time and is not the block size of the filesystem. You can change that when you create the filesystem via the mkfs command but the system knows the value when it is mounted.

It is possible to create a partition table and filesystems within a loop file but it is a bit more complicated.

All times are GMT -5. The time now is 01:09 PM.