LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-14-2013, 07:19 AM   #1
permissive
LQ Newbie
 
Registered: Mar 2013
Posts: 23

Rep: Reputation: Disabled
Align USB flash drives to 4096 bytes as well such as SSDs? Check in Linux?


http://lifehacker.com/5837769/make-s...ve-performance

To see if your partitions are aligned correctly, hit the Start menu and type in
Code:
msinfo32
. Enter Msinfo32 and go to Components > Storage > Disks. Look for your SSD on the list and find the "Partition Starting Offset" item. If this number is divisible by 4096 (that is, if dividing it by 4096 equals a whole number and not a decimal), your partition is correctly aligned.


I am looking for the same thing in Linux.

Are you supposed to align your USB flash drives to 4096 bytes as well as SSDs? Some of mine are aligned, some don't, strangely. Is there a detailed step by step guide to do that?

Last edited by permissive; 08-18-2013 at 09:01 AM.
 
Old 08-14-2013, 11:37 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,

You can do a LQ search for 'SSD alignment' and get loads of helpful threads/posts.

One of many that should help;
https://www.linuxquestions.org/quest...sd-4175414207/
 
Old 08-14-2013, 04:04 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
I doubt you'd find much improvement. USB flash drives tend to be a collection of weird stuff going on inside. Not sure I'd ever attempt to fool with them. They may mount like a scsi but aren't internally a true drive. Maybe CF or SD flash may be more ISO like.
 
1 members found this post helpful.
Old 08-15-2013, 02:15 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
For SSDs, you want to avoid layouts that would have an erase block, which might be 256KB, that spans more than one filesystem. It's not for performance reasons, but for data integrity. You want to avoid operations in one filesystem causing part of another filesystem to be copied and reallocated. That's why modern partitioning tools default to 1-Megabyte alignment for partitions.
 
Old 08-15-2013, 03:02 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
"Are you supposed to align your USB flash drives to 4096 "

No, I have never heard of it.
 
1 members found this post helpful.
Old 08-18-2013, 08:55 AM   #6
permissive
LQ Newbie
 
Registered: Mar 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by onebuck View Post
Hi,

You can do a LQ search for 'SSD alignment' and get loads of helpful threads/posts.
Thanks, but I did not ask for SSD alignment.

Quote:
Originally Posted by onebuck View Post
Besides, this thread is definitely not the definitive one regarding usefulness even if one looks for SSD alignment.
 
Old 08-18-2013, 09:00 AM   #7
permissive
LQ Newbie
 
Registered: Mar 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
For SSDs, you want to avoid layouts that would have an erase block, which might be 256KB, that spans more than one filesystem. It's not for performance reasons, but for data integrity. You want to avoid operations in one filesystem causing part of another filesystem to be copied and reallocated. That's why modern partitioning tools default to 1-Megabyte alignment for partitions.
I am sorry I have no idea what do you mean by 256 kb and 1 Mb alignments. Perhaps a link to a definitive article would be helpful.

All I heard is the 4096 byte alignments - http://en.wikipedia.org/wiki/Advanced_Format

---------- Post added 08-18-13 at 09:01 AM ----------

Quote:
Originally Posted by permissive View Post
http://lifehacker.com/5837769/make-s...ve-performance

To see if your partitions are aligned correctly, hit the Start menu and type in
Code:
msinfo32
. Enter Msinfo32 and go to Components > Storage > Disks. Look for your SSD on the list and find the "Partition Starting Offset" item. If this number is divisible by 4096 (that is, if dividing it by 4096 equals a whole number and not a decimal), your partition is correctly aligned.


I am looking for the same thing in Linux.
To back to my original question - anyone has a solution for this?
 
Old 08-18-2013, 09:46 AM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member Response

Hi,
Quote:
Originally Posted by permissive View Post
Thanks, but I did not ask for SSD alignment.

Besides, this thread is definitely not the definitive one regarding usefulness even if one looks for SSD alignment.
There are links within the referenced links to help you. You did say "as well such as SSDs". Rather broken sentence but you did refer to 'SSD'. At least that is what I got from the title.
 
Old 08-18-2013, 11:44 AM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
See post #5

There is a hardware issue with usb flash drives. They are not all the same. They were never intended to replicate a hard drive. They may have some very odd coding in them to match odd memory chips or odd controllers. Don't bother to align them. You won't find any benefit.

You are welcome to try some of the already posted links to ways one might do it for a ssd. Do this only on a test usb flash. It may not work on all of them and may even bork the drive.
 
Old 08-18-2013, 09:16 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by permissive View Post
I am sorry I have no idea what do you mean by 256 kb and 1 Mb alignments. Perhaps a link to a definitive article would be helpful.
I'll just offer this quote from the Red Hat Solid State Disk Deployment Guidelines:
"Because of the internal layout and operation of SSDs, it is best to partition devices on an internal erase block boundary. Partitioning utilities in Red Hat Enterprise Linux 6 chooses sane defaults if the SSD exports topology information.

"However, if the device does not export topology information, Red Hat recommends that the first partition be created at a 1MB boundary."
For information about erase block sizes, I suggest any of the Google hits on "ssd erase block".
 
Old 08-19-2013, 06:32 AM   #11
permissive
LQ Newbie
 
Registered: Mar 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thanks for your feedbacks. I'll look into the links.

About USB sticks were never intended to replace HDDs? They have come a long time, definitely. Think about USB3 sticks, certified to run Windows 8 from it. Along the same thinking, they would just run a Linux even faster than Windows.

-

OK, and anyone knows the answer to the 1st part of my Original Post? That would be more interesting or important than all we are talking about here. Thank you.
 
Old 08-19-2013, 06:36 AM   #12
permissive
LQ Newbie
 
Registered: Mar 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
"However, if the device does not export topology information, Red Hat recommends that the first partition be created at a 1MB boundary."
Fdisk uses this default too, I cannot even override it, so I guess it is a non-issue...

Quote:
Originally Posted by rknichols View Post
For information about erase block sizes, I suggest any of the Google hits on "ssd erase block".
So it is the TRIM command in plain English? (First result in the search link) As it is default in modern operating systems, at least in Windows 7.
 
Old 08-19-2013, 10:35 AM   #13
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by permissive View Post
So it is the TRIM command in plain English? (First result in the search link) As it is default in modern operating systems, at least in Windows 7.
You seem to lack an understanding of how the flash memory used in flash drives and SSDs works. You cannot write ONEs to flash memory cells. You can only write ZEROs. Only by erasing an entire block can its cells be changed back to ONEs. The erase blocks are large, typically 256KB, 512KB, or even larger in newer, higher density devices. Your OS, on the other hand, will read and write data in sector-size units of 512 or 4096 bytes. When the flash memory controller sees a write that would update part of a block that is currently in use, it reads the entire block, reallocates that block to a new, currently erased block, and writes out the entire block including the modifications. The old block is then marked "free", and will be erased to all ONEs at some future time. Unless you are happy with having writes to one filesystem possibly causing part of a different filesystem to be reallocated and copied, it is undesirable to have an erase block that spans more than one filesystem.

Erasing a block is a relatively slow operation, so for efficiency the controller needs to maintain a pool of blocks that are in the erased state. The TRIM command is a way for the OS to tell the flash controller that the data in a block is no longer needed and the block can be marked "free." But the TRIM command is actually of fairly minor importance in modern drives. The flash device actually contains significantly more blocks than its advertised capacity, so there is always a pool of blocks not currently in use. In fact, enabling automatic TRIM can seriously hurt performance. Prior to SATA 3.1, TRIM was defined as a non-queueable command, so using the "discard" (automatic TRIM) option can cause slow write performance. Scheduling a once-a-day fstrim operation a a cron job might be preferable.
 
1 members found this post helpful.
Old 08-19-2013, 02:42 PM   #14
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,984

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
I suggest that you test a usb flash using some performance suite in linux. Do this before and after you align it. Then post the results.
 
Old 08-20-2013, 05:49 AM   #15
permissive
LQ Newbie
 
Registered: Mar 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by permissive View Post
http://lifehacker.com/5837769/make-s...ve-performance

To see if your partitions are aligned correctly, hit the Start menu and type in
Code:
msinfo32
. Enter Msinfo32 and go to Components > Storage > Disks. Look for your SSD on the list and find the "Partition Starting Offset" item. If this number is divisible by 4096 (that is, if dividing it by 4096 equals a whole number and not a decimal), your partition is correctly aligned.


I am looking for the same thing in Linux.
OK, and actually anyone has anything to say about my original REAL question? If you say "I have no idea" that's OK to me, I stop quoting myself again and again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: USB 2.0 vs. USB 3.0 Flash Drives On Linux LXer Syndicated Linux News 0 03-04-2013 11:50 PM
Soon to be first time Linux user - Question about USB Flash Drives CT_0000 Linux - Newbie 4 09-30-2009 04:19 PM
Usb Flash Drives Not Working On Linux paq7512 Mandriva 8 05-23-2008 08:55 PM
Directories always 4096 bytes? riwaJR Debian 4 04-03-2006 01:16 PM
connection reset after 4096 bytes when using FTP to access remote server socrates71 Linux - Networking 2 10-20-2005 08:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration