Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: TRIM on everything?

  1. #1
    Join Date
    Sep 2009
    Location
    USA
    Beans
    444
    Distro
    Kubuntu

    TRIM on everything?

    So, I have a question about TRIM. If I've read correctly, I have it enabled on my SSD. But do I need it enabled on the SWAP partition? I also have my /boot on a separate partition, do I need to enable TRIM on that somehow?

    I read somewhere that those partitions also need it. But I'm not sure.

    My question gets more complicated also. I have full disk-encryption set up. So I have TRIM enabled (discard) in my fstab and my crypttab.

    I have an encrypted container, within which has logical volumes for my root drive and my swap space.

    In crypttab, there is only one entry for the encrypted container. So I added discard to that.

    But in my fstab, I only added "discard" to my root drive. Is that a problem? Do I need to add it to swap space.

    What about boot? Its not encrypted, but its still on the SSD. I know it isn't used much, but would it still be wise to use TRIM (discard) on it as well?

    So, TL;DR -- Do I need TRIM enabled on SWAP or /boot partitions? And second, if I have full-disk encryption, do I need to enable TRIM on all logical volumes, or is enabling it in crypttab enough?

  2. #2
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,744

    Re: TRIM on everything?

    Quote Originally Posted by NertSkull View Post
    So, I have a question about TRIM. If I've read correctly, I have it enabled on my SSD. But do I need it enabled on the SWAP partition? I also have my /boot on a separate partition, do I need to enable TRIM on that somehow?

    I read somewhere that those partitions also need it. But I'm not sure.

    My question gets more complicated also. I have full disk-encryption set up. So I have TRIM enabled (discard) in my fstab and my crypttab.

    I have an encrypted container, within which has logical volumes for my root drive and my swap space.

    In crypttab, there is only one entry for the encrypted container. So I added discard to that.

    But in my fstab, I only added "discard" to my root drive. Is that a problem? Do I need to add it to swap space.

    What about boot? Its not encrypted, but its still on the SSD. I know it isn't used much, but would it still be wise to use TRIM (discard) on it as well?

    So, TL;DR -- Do I need TRIM enabled on SWAP or /boot partitions? And second, if I have full-disk encryption, do I need to enable TRIM on all logical volumes, or is enabling it in crypttab enough?
    swap shouldnt be on a SSD if you can help it, and wont support discard anyway
    Last edited by haqking; December 13th, 2012 at 01:53 PM.
    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  3. #3
    Join Date
    Sep 2009
    Location
    USA
    Beans
    444
    Distro
    Kubuntu

    Re: TRIM on everything?

    I don't know, everything I've read about that is about the argument that its not cost-efficient to do. Right now I have a 240 GB SSD with 8 gigs of RAM. My swap effectively never gets used, except for when I put the computer into hibernation. And its easier to set up single passphrase unlocking encryption by just encrypting the drive, and making a 10 gig logical volume swap partition within the encrypted container, and leave the other 200+ gigs as the root drive.

    I know its not considered by many to be ideal to put swap on the SSD. But 8 gigs of RAM is enough for what I do that it never gets used except in hibernate mode. But I could definitely be wrong about all that and maybe SWAP on SSD destroys the drive in a way I'm unaware of.

    So that's why I'm wondering if TRIM should be enabled, but it appears you say it won't support it anyway. So that's good to know.

    But even so, what about boot?
    Last edited by NertSkull; December 13th, 2012 at 02:04 PM.

  4. #4
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,744

    Re: TRIM on everything?

    Quote Originally Posted by NertSkull View Post
    I don't know, everything I've read about that is about the argument that its not cost-efficient to do. Right now I have a 240 GB SSD with 8 gigs of RAM. My swap effectively never gets used, except for when I put the computer into hibernation. And its easier to set up single passphrase unlocking encryption by just encrypting the drive, and making a 10 gig logical volume swap partition within the encrypted container, and leave the other 200+ gigs as the root drive.

    I know its not considered by many to be ideal to put swap on the SSD. But 8 gigs of RAM is enough for what I do that it never gets used except in hibernate mode. But I could definitely be wrong about all that and maybe SWAP on SSD destroys the drive in a way I'm unaware of.

    So that's why I'm wondering if TRIM should be enabled.

    But even so, what about boot?
    swap wont support TRIM anyways.

    /boot is hardly written too so redundant and should probably be ext2 aswell and mount /tmp to RAM
    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  5. #5
    Join Date
    Sep 2009
    Location
    USA
    Beans
    444
    Distro
    Kubuntu

    Re: TRIM on everything?

    I didn't realize that ext2 doesn't really support trim. But my boot is mounted as ext2, so TRIM is not needed there.

    Thanks for the help, it makes more sense now.

  6. #6
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,744

    Re: TRIM on everything?

    Quote Originally Posted by NertSkull View Post
    I didn't realize that ext2 doesn't really support trim. But my boot is mounted as ext2, so TRIM is not needed there.

    Thanks for the help, it makes more sense now.

    Ext2 does support trim but not fully, no point doing it for /boot as it is hardly written too.

    /boot should be ext2 typically as journalling/overhead is not required

    EXT4 supports TRIM fully

    If i was you, use TRIM for /HOME and / and mount /tmp to RAM.

    For example here is my FSTAB

    Code:
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    nodev,noexec,nosuid 0       0
    # / was on /dev/sda1 during installation
    UUID=2e19524f-b028-4ef3-93a5-bed6757708fc /               ext4    defaults,noatime,nodiratime,discard,errors=remount-ro        0       1
    # /DATA was on /dev/sdc1 during installation
    # UUID=3A2084D220849713 /DATA           ntfs    defaults,umask=007,gid=46 0       0
    # /SSD2DATA was on /dev/sdb1 during installation
    UUID=de961735-1d84-4c72-8abe-fefa7b03a708 /SSD2DATA       ext4    defaults,noatime,nodiratime,discard,errors=remount-ro        0       2
    # /home was on /dev/sda2 during installation
    UUID=5a71aee7-cd8c-431f-bdc3-828bc40226b7 /home           ext4    defaults,noatime,nodiratime,discard,errors=remount-ro        0       2
    # swap was on /dev/sdc2 during installation
    UUID=c01746dc-7f90-40a6-9dda-324aecf9bdce none            swap    sw              0       0
    # Place tmp into ram
    tmpfs       /tmp        tmpfs       defaults,mode=1777      0   0
    tmpfs       /var/tmp    tmpfs       defaults,mode=1777      0   0
    tmpfs       /var/spool  tmpfs       defaults,mode=1777      0   0
    tmpfs       /var/cache  tmpfs       defaults                0   0
    Optimised for SSD
    Last edited by haqking; December 13th, 2012 at 02:49 PM.
    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  7. #7
    Join Date
    Jul 2006
    Location
    Castrum, Germania Secunda
    Beans
    1,071

    Re: TRIM on everything?

    Here's a complete how-to for tuning an SSD:
    https://sites.google.com/site/easylinuxtipsproject/ssd

    Notes:
    - Don't put /var/tmp in tmpfs in RAM, as /var/tmp is meant for temporary files that need to survive a reboot;
    - A swap partition will be trimmed automatically, upon mounting at each boot. No tuning necessary.

  8. #8
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: TRIM on everything?

    Quote Originally Posted by Pjotr123 View Post
    ...
    Notes:
    - Don't put /var/tmp in tmpfs in RAM, as /var/tmp is meant for temporary files that need to survive a reboot;
    Where did you get that idea? Can you please document that? I'm curious to see the logic.

    My understanding was that /tmp will NOT survive either a warm or cold boot. I just restarted my machine (@ 11:51) and nothing survived. See
    Code:
    drwx------ 2 bab bab 4096 2012-12-13 11:51 keyring-G7BRQT
    drwx------ 2 bab bab 4096 2012-12-13 11:55 orbit-bab
    drwx------ 2 gdm gdm 4096 2012-12-13 11:51 orbit-gdm
    drwx------ 2 bab bab 4096 2012-12-13 11:51 pulse-2hO62oopsgCl
    drwx------ 2 bab bab 4096 2012-12-13 11:51 ssh-JufHfP1511
    drwx------ 2 bab bab 4096 2012-12-13 11:51 virtual-bab.TegvC3
    -BAB1

  9. #9
    Join Date
    Jun 2011
    Location
    The Shadow Gallery
    Beans
    6,744

    Re: TRIM on everything?

    Quote Originally Posted by bab1 View Post
    Where did you get that idea? Can you please document that? I'm curious to see the logic.

    My understanding was that /tmp will NOT survive either a warm or cold boot. I just restarted my machine (@ 11:51) and nothing survived. See
    Code:
    drwx------ 2 bab bab 4096 2012-12-13 11:51 keyring-G7BRQT
    drwx------ 2 bab bab 4096 2012-12-13 11:55 orbit-bab
    drwx------ 2 gdm gdm 4096 2012-12-13 11:51 orbit-gdm
    drwx------ 2 bab bab 4096 2012-12-13 11:51 pulse-2hO62oopsgCl
    drwx------ 2 bab bab 4096 2012-12-13 11:51 ssh-JufHfP1511
    drwx------ 2 bab bab 4096 2012-12-13 11:51 virtual-bab.TegvC3
    it is defined in the FHS https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

    var/tmp Temporary files to be preserved between reboots.
    /var/tmp is different to /tmp
    Backtrack - Giving machine guns to monkeys since 2006
    Kali-Linux - Adding a grenade launcher to the machine guns since 2013

  10. #10
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: TRIM on everything?

    Quote Originally Posted by haqking View Post
    it is defined in the FHS https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard



    /var/tmp is different to /tmp
    Ahhhh, I missed the /var part. My mistake.
    -BAB1

Page 1 of 2 12 LastLast

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
  •