this post was submitted on 18 Jun 2024
23 points (89.7% liked)

Selfhosted

49411 readers
1155 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

Hello,

I am going to upgrade my server, taking advantage of the fact that I am going to be able to put more hard disks, I wanted to take advantage of this to give a little more security (against loss) to my data.

Currently I have 2 hard drives in ext4 with information, and wanted to buy a third (same capacity all three) and place them in raid5, so that in the future, I can put more hard drives and increase the capacity.

Due to economic issues, right now I can only buy what would be the third disk, so it is impossible for me to back up the data I currently have.

The data itself is not valuable, in case any file gets corrupted, I could download it again, however there are enough teras (20) to make downloading everything a madness.

In principle I thought to put on this server (PC) a dietpi, a trimmed debian and maybe with mdadm make the raid. I have seen tutorials on how to do it (this for example https://ruan.dev/blog/2022/06/29/create-a-raid5-array-with-mdadm-on-linux ).

The question is, is there any way without having to format the hard drives with data?

Thank you and sorry for any mistakes I may make, English is not my mother language.

EDIT:

Thanks for yours answers!! I have several paths to investigate.

you are viewing a single comment's thread
view the rest of the comments
[–] SwingingTheLamp@midwest.social 20 points 1 year ago (14 children)

This is madness, but since this is a hobby project and not a production server, there is a way:

  • Shrink the filesystems on the existing disks to free up as much space as possible, and shrink their partitions.
  • Add a new partition to each of the three disks, and make a RAID5 volume from those partitions.
  • Move as many files as possible to the new RAID5 volume to free up space in the old filesystems.
  • Shrink the old filesystems/partitions again.
  • Expand each RAID component partition one at a time by removing it from the array, resizing it into the empty space, and re-adding it to the array, giving plenty of time for the array to rebuild.
  • Move files, shrink the old partitions, and expand the new array partitions as many times as needed until all the files are moved.

This could take several days to accomplish, because of the RAID5 rebuild times. The less free space, the more iterations and the longer it will take.

[–] just_another_person@lemmy.world 1 points 1 year ago* (last edited 1 year ago) (12 children)

He said the two drives are mostly full. It's not a paritioning issue at that point.

[–] chiisana@lemmy.chiisana.net 7 points 1 year ago (11 children)

Even if you could free up only 1GB on each of the drives, you could start the process with a RAID5 of 1GB per disk, migrate two TB of data into it, free up the 2GB in the old disks, to expand the RAID and rinse and repeat. It will take a very long time, and run a lot of risk due to increased stress on the old drives, but it is certainly something that’s theoretically achievable.

[–] HamsterRage@lemmy.ca 9 points 1 year ago* (last edited 1 year ago) (1 children)

Technically, he would have three drives and only two drives of data. So he could move 1/3 of the data off each of the two drives onto the third and then start off with RAID 5 across the remaining 1/3 of each drive.

[–] chiisana@lemmy.chiisana.net 4 points 1 year ago

This is smart! Should help reduce the number of loops they’d need to go through and could reduce the stress on the older drives.

load more comments (9 replies)
load more comments (9 replies)
load more comments (10 replies)