How to align Linux disk partitions without data loss?

0

As you know, 512B sectors is still used in file systems of most current Linux distributions while the hardware, i.e. physical disks are typically made with 4K sectors. The misalignment of logical file system sectors and physical sectors leads to redundant read/write operations, and thus reduces IO performance, especially with a large portion of IO operations smaller than 4K bytes.

Making it worse, I have a lot valuable user data on the 512B-sector partition. Creating a new 4K partition and moving data in can work, however, we prefer aligning the partition IN PLACE for efficiency.

To do this in Windows, we have PAT (Paragon Alignment Tool). I am looking for its Linux counterpart.

So, my question is:

  1. Is there a tool like PAT for Linux?
  2. If there isn't, can I have a tip?

user2235212

Posted 2013-04-02T09:46:52.640

Reputation: 1

The first thing you do is backup the data. – Ramhound – 2013-04-02T11:18:26.140

I don't think it's possible but I'm not an expert. By the way: You didn't mention what file system you are using. – FSMaxB – 2013-04-02T11:28:41.957

@FSMaxB A portable way is preferable. I'd rather this 'tool' can leave the file system alone and work either above it or underneath it. If not possible, we can just focus on ext2/ext3. – user2235212 – 2013-04-02T11:55:08.943

If the partitions have been created with a somewhat recent tool (~mid 2010 and forwards), this should have been taken into account automatically on Linux, even if you did not address this yourself during that time. Note that fdisk does not support GPT, which is often used for modern disks, so use e.g. GParted to check the current status. – Daniel Andersson – 2013-04-02T11:55:10.483

@Ramhound Yes, but I want to lower the cost, because by saying 'a lot user data', I mean, thousands of servers, multiplied with 1TB data. – user2235212 – 2013-04-02T11:59:53.823

@DanielAndersson A few recent Linux distributions, like CentOS 6, do use 4K-sector partition in default. Unfortunately, we are running old Linux servers, with valuable user data on them. – user2235212 – 2013-04-02T12:05:54.087

@YAOHaowei - Anything we suggest is not guaranteed not to result in data loss. – Ramhound – 2013-04-02T12:07:28.153

If the data is important for users, you must have backups that you can restore from. If you don't have this, then someone is not doing their job. If you can't manage a single hardware outage, then the data is as good as lost anyway, just give it time. Since you won't be able to do the conversion online anyway, you will have downtime no matter what, so a "real" solution will probably save time in the end, for users and most of all for admins, instead of trying semi-stable hacks to avoid formatting. – Daniel Andersson – 2013-04-02T12:12:16.500

@Ramhound Yes, I agree. The best thing to do is, NOTHING. But we are suffering from disk IO performance, it's a bonus if we can find a way to do that. We can test our method on a small data set, and expand it when we are confident. – user2235212 – 2013-04-02T12:13:12.103

Just to be explicit: any distribution with fdisk/Gparted/etc versions more recent than summer 2010 (fdisk >=0.6, GParted >=0.6.0) will use 4k sectors by default if applicable. It is definitely possible to run distributions less recent than that, but for several years it has been the norm to have support for this OOTB. – Daniel Andersson – 2013-04-02T12:15:21.310

@DanielAndersson Yeah, so I think the reason we have this problem is, the admin guys are too conservative. They tends to use legacy, stable version of software instead of trying new features. – user2235212 – 2013-04-02T12:25:58.297

No answers