Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting XFS RAID5 to EXT4 #50

Open
NickJH opened this issue Jan 12, 2023 · 3 comments
Open

Converting XFS RAID5 to EXT4 #50

NickJH opened this issue Jan 12, 2023 · 3 comments
Assignees
Labels

Comments

@NickJH
Copy link

NickJH commented Jan 12, 2023

Hi, this is a question rather than a problem. I have a (degraded as one disk is missing) 54TB RAID5 array (was 4 x 18TB) formatted as XFS. I don't want to replace the missing disk, but just shrink the filesystem to allow me to convert the array to a 3 disk RAID5. There is a bit less than 10TB of data on the array. Are the conversion times dependent on actual disk usage or partition size? I am trying to gauge how long it may take. 36 days at 16h/1TB based on the partition size I can't do but I can think about 160h based on the data size.

@cosmos72
Copy link
Owner

cosmos72 commented Jan 14, 2023

Hi NickJH,
the fastest option is undoubtedly copying the data on some other disk, then reformat, and finally copy back the data - provided you have 10TB free space somewhere, of course.

Converting a 54TB filesystem with 10TB data in it will take approximately as long as converting a ~30TB full (or almost full) filesystem. The reason is there are three main steps during conversion:

  1. Create a sparse loop file, format it, mount it and move all files into it. The time it takes is proportional to actual disk usage
  2. Remap the loop file onto the underlying device (partition, raid device...). Again, the time it takes is proportional to actual disk usage.
  3. Cleanup: all unused space in the converted filesystem is filled with zeroes. This takes a time proportional to the partition size.

Skipping step 3. is a tempting speedup, but in my experience it has the bad habit of leaving a corrupted filesystem

@cosmos72 cosmos72 self-assigned this Jan 14, 2023
@cosmos72
Copy link
Owner

cosmos72 commented Jan 14, 2023

Update: if XFS supports shrinking the filesystem, you should definitely shrink it - and the underlying partition - before running fstransform.

In this way, you'll be converting a smaller filesystem and step 3. above will be accordingly faster.

Alternatively, there is a way to convince fstransform to shrink the filesystem while converting it, but I don't remember if the main program supports it directly or you'll have to fiddle with the low-level tools fsmove and fsremap

@NickJH
Copy link
Author

NickJH commented Jan 14, 2023

That is the nub of the issue. I am trying to change the array from 4 x 18TB to 3 x 18TB due to disk failure and not needing the extra space. The array is XFS formatted but XFS does not support shrinking of partitions. To get round it, I was going to convert it to EXT4 so I could shrink it and then leave it as EXT4. I may be able to get enough disks together to be able to temporarily move the data off the array then go for a simple reformat, or even a full array rebuild to save doing a reshape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants