+ Reply to Thread
Page 7 of 21
FirstFirst ... 5 6 7 8 9 17 ... LastLast
Results 91 to 105 of 308

Thread: Linux - Tips, tweaks and alignment

  1. #91
    OCZ Convert b2bde4's Avatar Users Country Flag
    Join Date
    Mar 2009
    Posts
    227
    Mobo: (ASUS) AMD 780G + SB700
    CPU: AMD 4850e
    RAM: 4GB
    Vid: Passive ATI 2600XT
    PSU: 620W
    HDD: Vertex 30GB, FW 1.5
    OS: Ubuntu (9.10)

    Quote Originally Posted by FZ1 View Post
    Man, I gotta get crackin' on Linux. This stuff is going over my head
    Most of the discussion is about understanding alignment.

  2. #92

    Quote Originally Posted by b2bde4 View Post
    I will verify it virtually. **Starting VirtualBox...**

    Quted post gone??
    Yes... I tried it again and noticed the following
    strange behavior:

    - fdisk does reduce the number of heads to a maximum of
    255 if you specify it as -H on the command line.

    - On the other hand, if you switch to expert
    mode in fdisk and type "h" (for changing the
    number of heads), then fdisk shows this:
    Code:
    Expert command (m for help): h
    Number of heads (1-256, default 255):
    If you type 256 here, then it will not be truncated.

    The bottom line is that you can use 256 heads,
    but only if you set the number of heads in expert mode.
    I confused this in the original post and so I deleted that.

  3. #93
    OCZ Convert b2bde4's Avatar Users Country Flag
    Join Date
    Mar 2009
    Posts
    227
    Mobo: (ASUS) AMD 780G + SB700
    CPU: AMD 4850e
    RAM: 4GB
    Vid: Passive ATI 2600XT
    PSU: 620W
    HDD: Vertex 30GB, FW 1.5
    OS: Ubuntu (9.10)

    Quote Originally Posted by TortureTest View Post
    Yes... I tried it again and noticed the following
    strange behavior:

    - fdisk does reduce the number of heads to a maximum of
    255 if you specify it as -H on the command line.

    - On the other hand, if you switch to expert
    mode in fdisk and type "h" (for changing the
    number of heads), then fdisk shows this:
    Code:
    Expert command (m for help): h
    Number of heads (1-256, default 255):
    If you type 256 here, then it will not be truncated.
    The bottom line is that you can use 256 heads,
    but only if you set the number of heads in expert mode.
    Yes, I noticed. The question is, should we recommend it?

  4. #94

    Quote Originally Posted by b2bde4 View Post
    Yes, I noticed. The question is, should we recommend it?
    I don't think so. Has anyone set their drive up in such a manner, rebooted it, and see if it's still working as expected?

  5. #95
    OCZ Convert b2bde4's Avatar Users Country Flag
    Join Date
    Mar 2009
    Posts
    227
    Mobo: (ASUS) AMD 780G + SB700
    CPU: AMD 4850e
    RAM: 4GB
    Vid: Passive ATI 2600XT
    PSU: 620W
    HDD: Vertex 30GB, FW 1.5
    OS: Ubuntu (9.10)

    Quote Originally Posted by Pigeon View Post
    I don't think so. Has anyone set their drive up in such a manner, rebooted it, and see if it's still working as expected?
    Not as far as I know.

  6. #96

    Quote Originally Posted by Pigeon View Post
    I don't think so. Has anyone set their drive up in such a manner, rebooted it, and see if it's still working as expected?
    I have partitioned a drive in this way. After writing the partition
    table, fdisk -l shows that the 256 heads organization is indeed
    kept:
    Code:
    # fdisk -l
    Disk /dev/sdb: 8237 MB, 8237408256 bytes
    256 heads, 32 sectors/track, 1963 cylinders
    Units = cylinders of 8192 * 512 = 4194304 bytes
    Disk identifier: -----
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1        1963     8040432   83  Linux
    That's the only way to obtain cylinders with a size
    of exactly 4MB. On the other hand, you can obtain
    a 4MB offset by using two 2MB cylinders (or other
    multiples of smaller cylinders). Therefore using 256
    heads is not really necessary, and I would not
    recommend it.

  7. #97
    OCZ Convert b2bde4's Avatar Users Country Flag
    Join Date
    Mar 2009
    Posts
    227
    Mobo: (ASUS) AMD 780G + SB700
    CPU: AMD 4850e
    RAM: 4GB
    Vid: Passive ATI 2600XT
    PSU: 620W
    HDD: Vertex 30GB, FW 1.5
    OS: Ubuntu (9.10)

    Cylinder Alignment Table.

    The Vertex SSD has an erase block size of 512kB. To properly align your SSD for writes, use one of the following parameters when starting fdisk. If you specify the start of every partition manually you don't need to use this table. The main purpose of using the S option and the H option is for automatic partition alignment as some tools has the ability to round to cylinders.

    If you create your partitions with fdisk using cylinders, you'll get automatic alignment using this table. Just make sure to start your first partition on the second cylinder.

    Code:
    Cylinder size (Times 512k)
    1024K (x2)
      -S 16 -H 128
      -S 32 -H 64
    512K (x1)
      -S 8 -H 128
      -S 16 -H 64
      -S 32 -H 32
    256K (x0.5)
      -S 4 -H 128
      -S 8 -H 64
      -S 16 -H 32
      -S 32 -H 16
    128K (x0.25)
      -S 2 -H 128
      -S 4 -H 64
      -S 8 -H 32
      -S 16 -H 16
      -S 32 -H 8
    Last edited by b2bde4; 04-10-2009 at 05:57 PM.

  8. #98

    FZ1 is right that this discussion on alignment has become
    hard to follow. The relevant information is spread over posts
    of Amozz, b2bde4, octoploid, clarknova, and others.
    Here I will try to describe the easiest way to align, in a
    step-by-step fashion, using fdisk.

    Partition alignment for OCZ Vertex in Linux

    This guide will show you how to set up general alignment for use with Linux.
    Tweaking some of the values used will yield different results.

    Background information

    SSDs work fastest if partitions are properly aligned. For the
    Vertex drive, an alignment size of 64KB (128 sectors) has
    been proposed in this forum.
    On the other hand, since write operations to an SSD
    always affect a whole erase block, it makes sense to
    align to the erase block size, which is 512KB for OCZ Vertex.
    Note that a 512KB aligned drive is also 64KB aligned,
    because 512KB is a multiple of 64KB.
    In the following, I will therefore assume that you want
    a 512KB alignment; other possible alignment sizes
    are discussed later.

    Since the first partition cannot start at 0, minimal loss
    of capacity is obtained if the first partition starts at the
    first 512K position instead.
    To achieve this, 512KB must be a multiple of the cylinder size
    (at least if the partition is to start at a cylinder boundary,
    which is probably a good idea).
    It is convenient to use 512KB directly for the cylinder size
    - then all partitions except for the first one are automatically
    512KB aligned (with other sizes you might have to calculate).
    We obtain cylinders with 512KB size by using 32 heads and
    32 sectors/track (see table below).

    The first partition needs special treatment because it is
    automatically shifted by one track if you do not intervene.
    This can be done in fdisk expert mode, but I have noticed that
    you obtain the same effect if you simply let the first partition
    start at cylinder 2 instead of cylinder 1. You do not need the
    expert mode in this case, so I adopt this method for simplicity.

    Step-by-step guide
    In the following I will show the necessary steps for creating
    a linux partition (type 83) with 512KB alignment using fdisk.
    If you have no Linux system installed yet, start from a Live CD
    or use the "rescue system" option that comes with some
    distributions to get a Linux command prompt.
    The following commands are prefixed by sudo because they
    require superuser privileges.
    Code:
    $ sudo fdisk -H 32 -S 32 /dev/sda
    
    The number of cylinders for this disk is set to 15711.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)
    
    Command (m for help): o
    Building a new DOS disklabel with disk identifier 0x8cb3d286.
    Changes will remain in memory only, until you decide to write them.
    After that, of course, the previous content won't be recoverable.
    
    The number of cylinders for this disk is set to 15711.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-15711, default 1): 2
    Last cylinder, +cylinders or +size{K,M,G} (2-15711, default 15711):
    Using default value 15711
    
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 83
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.
    Basically, fdisk is started with correct -H and -S options. Then "o"
    creates a new partition table, "n" creates the partition, "t" sets the
    partition type, and "w" writes everything to disk.

    Verify result
    Let's first check if the intended geometry is stored correctly:
    Code:
    $ sudo fdisk -l /dev/sda
    
    Disk /dev/sda: 8237 MB, 8237408256 bytes
    32 heads, 32 sectors/track, 15711 cylinders
    Units = cylinders of 1024 * 512 = 524288 bytes
    Disk identifier: 0x8cb3d286
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               2       15711     8043520   83  Linux
    As you can see, the geometry (32 heads, 32 sectors/track) has been stored as intended.
    The cylinders also have the intended size (1024 * 512 Bytes = 512KB).
    Now let's check the alignment:
    Code:
    $ sudo fdisk -lu /dev/sda
    
    Disk /dev/sda: 8237 MB, 8237408256 bytes
    32 heads, 32 sectors/track, 15711 cylinders, total 16088688 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Disk identifier: 0x8cb3d286
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1            1024    16088063     8043520   83  Linux
    If you call fdisk with the -u option, positions are shown in sectors.
    Each sector has 512 byte. You can see from the output of fdisk -lu
    that the first partition is indeed 512KB aligned (1024 * 512 Byte = 512KB).
    Moreover, only 512KB at the beginning of the drive are wasted.

    Other alignment sizes
    It is not necessarily so that you get best performance with a 512KB
    alignment. If you want to align to a 64 KB (128 sectors) alignment size
    instead (as suggested in this forum for Windows), then using
    fdisk -H 8 -S 16 /dev/sda will result in the 64KB cylinder size appropriate
    for 64KB alignment. For other alignment sizes, you can look up suitable
    -H and -S values for fdisk in b2bde4's Cylinder alignment table.
    Apart from the different options for fdisk, stick to the above description.

    Special case: "Partitionless" drive with a single filesystem
    (octoploid's suggestion):
    If you do not need several partitions on your SSD, and if you do not want
    to boot from it (or if you have another drive in your system to store the
    boot loader on), then explicit alignment can be avoided by creating a
    filesystem on the device as a whole. You don't need fdisk in this case.
    Just proceed as follows (with your preferred options to mke2fs, this is
    only an example):
    Code:
    $ sudo mke2fs -t ext2 /dev/sda
    mke2fs 1.41.1 (01-Sep-2008)
    /dev/sda is entire device, not just one partition!
    Proceed anyway? (y,n) y
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    ...
    This filesystem will be automatically checked every 20 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    Note that in the partitionless case, the whole drive must be mounted
    (i.e. /dev/sda instead of /dev/sda1). Therefore the mount command
    looks somewhat unusual, like this:
    Code:
    $ sudo mount /dev/sda /mnt
    With the "partitionless" method, you automatically get an aligned drive.
    You also have slightly more capacity compared to the fdisk method
    because there's no need to drop the first cylinder in this case.
    Last edited by TortureTest; 04-11-2009 at 09:32 AM.

  9. #99

    Propose adding recommendation of 'mke2fs ... -E stripe-width=128' for 512kB erase page block drives (vertex) or 'mke2fs ... -E stripe-width=32' for 128kB erase page block drives. (afaik everything else)

  10. #100
    OCZ Convert b2bde4's Avatar Users Country Flag
    Join Date
    Mar 2009
    Posts
    227
    Mobo: (ASUS) AMD 780G + SB700
    CPU: AMD 4850e
    RAM: 4GB
    Vid: Passive ATI 2600XT
    PSU: 620W
    HDD: Vertex 30GB, FW 1.5
    OS: Ubuntu (9.10)

    Nice guide I was about to make one myself. That's why I started on the cylinder alignment table

    I think ext4 should be in its own guide/post keeping this guide clean, short and easy to follow.

  11. #101
    Integrator Users Country Flag
    Join Date
    Apr 2009
    Location
    Fairview
    Posts
    25
    Mobo: ASUS M2A-VM (SB600)
    CPU: Athlon X2 4050e
    RAM: 4GB Kston ECC
    Vid: GByte 8600GT silent
    PSU: Seasonic S12II 330
    HDD: OCZ Vertex 30GB
    OS: Ubuntu 9.10 x86_64

    As this discussion evolves and guides updated and appended, a wiki starts to make more and more sense. I guess a sticky is no worse if the original poster keeps the first post up to date, otherwise a person has to read the whole thread and sublimate the best points.
    db

  12. #102
    OCZ User Octoploid's Avatar Users Country Flag
    Join Date
    Mar 2009
    Posts
    64
    Mobo: ASUS M4A78T-E
    BIOS: 1302
    CPU: AMD PhenomII X4 955
    RAM: 4GB OCZ Reaper
    Vid: Radeon HD 3300 (build in)
    HDD: OCZ Vertex, Samsung HD103UJ
    OS: Linux

    If you use the whole drive when you create the filesystem, you can still
    boot from this drive, but obviously the bootloader (grub) has to be located
    on another drive. So you just adjust /etc/fstab on your SSD and add your
    SSD's path to /boot/grub/grub.cfg on your old drive:
    Code:
    menuentry "git kernel" {
        set root=(hd0,1)
        linux /usr/src/linux/arch/x86/boot/bzImage root=/dev/sda1 rootflags=commit=60 hpet=force fbcon=rotate:3
    }
    
    menuentry "git kernel ssd" {
        set root=(hd1)
        linux /usr/src/linux/arch/x86/boot/bzImage root=/dev/sdb rootflags=commit=60 hpet=force fbcon=rotate:3
    }

  13. #103
    OCZ User Users Country Flag
    Join Date
    Mar 2009
    Posts
    60
    Mobo: 1) ASUS P6T Deluxe V2 2) ASUS P5W DH Deluxe
    BIOS: 1) 0302 2) 2801
    CPU: 1) Core i7 920 2) Core 2 Duo E6700
    RAM: 1) 12GB Patriot Viper PVT36G1600LLK 2) 8GB ******** KHX8500D2T1K2/4G
    Vid: 1) NVidia GeForce GTX 295 1) ATI Radeon HD3870x2
    PSU: 1) Hiper Type R Mk-II 680W 2) ******* HX620W
    HDD: 1) OCZ Vertex 60GB + Seagate 7200.12 500GB 2) OCZ Core v2 30GB + WD Raptor WD740ADFD + Caviar 250GB
    OS: 1) Vista Ultimate 64 + Ubuntu 9.04 2) Vista Home Premium 64 + Ubuntu 8.10

    Quote Originally Posted by TortureTest View Post
    FZ1 is right that this discussion on alignment has become
    hard to follow.
    Here I will try to describe the easiest way to align, in a
    step-by-step fashion, using fdisk.
    Hi TortureTest, I'm not sure if this was mentioned earlier or I just missed it somewhere, but unless you're logged in as root won't you need to use "sudo" to run fdisk?

    Also, someone could make a short guide for -any- user, because even XP and Vista users can utilize this information. The partition alignment listed here should also help Windows users, shouldn't it (assuming assigning it as NTFS)? And booting from a Live CD will allow anyone to partition the drive without needing Windows pre-installed...

  14. #104
    Integrator Users Country Flag
    Join Date
    Apr 2009
    Location
    Fairview
    Posts
    25
    Mobo: ASUS M2A-VM (SB600)
    CPU: Athlon X2 4050e
    RAM: 4GB Kston ECC
    Vid: GByte 8600GT silent
    PSU: Seasonic S12II 330
    HDD: OCZ Vertex 30GB
    OS: Ubuntu 9.10 x86_64

    Quote Originally Posted by khelvan View Post
    Hi TortureTest, I'm not sure if this was mentioned earlier or I just missed it somewhere, but unless you're logged in as root won't you need to use "sudo" to run fdisk?
    fdisk requires that you be root or use sudo, yes.

    The partition alignment listed here should also help Windows users, shouldn't it (assuming assigning it as NTFS)? And booting from a Live CD will allow anyone to partition the drive without needing Windows pre-installed...
    The partitioning guide laid out by Torture Test could be useful for any user using a Vertex or other SSD with similar physical properties. Windows' partitioner doesn't permit you to change CHS attributes, so a person following this guide would have to partition his SSD from linux booted from another hard drive or a live CD, as you said. Or perhaps get a more capable partitioner for Windows if that's what one is running.
    db

  15. #105

    Quote Originally Posted by khelvan View Post
    Hi TortureTest, I'm not sure if this was mentioned earlier or I just missed it somewhere, but unless you're logged in as root won't you need to use "sudo" to run fdisk?
    As clarknova confirmed, that's correct. The # prompt was intended to
    signal root privilege.

    Quote Originally Posted by Octoploid View Post
    If you use the whole drive when you create the filesystem, you can still
    boot from this drive, but obviously the bootloader (grub) has to be located
    on another drive.
    Thanks for pointing that out, I will change the guide accordingly.

+ Reply to Thread
Page 7 of 21
FirstFirst ... 5 6 7 8 9 17 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts