Results 1 to 6 of 6

Thread: How to create swap file on ext4

  1. #1
    Join Date
    Apr 2010
    Beans
    258

    Exclamation How to create swap file on ext4

    My friend whats to create a 4GB swap file on his ext4 file system. because he is using a chromebook acer c7 the way he installed he did not have a chance to specify swap partition
    and now he want to create a swap file on his file system.
    This is the guide he is following
    http://ubuntuforums.org/showthread.p...5#post10098565
    First you have to create a 2GiB file, for example in /mnt:
    Code:
    sudo dd if=/dev/zero of=/mnt/swap bs=1M count=2048
    Then format the file to swap:
    Code:
    sudo mkswap /mnt/swap
    Add the swap file to the system:
    Code:
    sudo swapon /mnt/swap
    Check it out, i.e.:
    Code:
    free -m
    Edit the fstab file:
    Code:
    gksu gedit /etc/fstab
    and add this line at the end of the file:
    Code:
    /mnt/swap  none  swap  sw
    Save the file and exit. That's all.
    This is what he is getting



    Code:
    user@chrubuntu:~$ sudo swapon /mnt/swap
    swapon: /mnt/swap: swapon failed: Invalid argument
    and his fstab looks like this




    any way to fix this ??
    One more thing he is using ubuntu 14.04 and it is not a fresh install
    Thank you for your time
    Last edited by Chelidze; May 4th, 2014 at 10:34 PM.

  2. #2
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    8,050
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: How to create swap file on ext4

    That is strange. Try using the swapon command with UUID

    Code:
    man swapon
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  3. #3
    Join Date
    Jun 2007
    Beans
    11,022

    Re: How to create swap file on ext4

    - There's nothing in the fstab so swapon probably won't work..
    - Does /mnt/swap exist?
    - Shouldn't '2048' have an M after it to specify MB instead of bytes?

  4. #4
    Join Date
    Oct 2005
    Location
    Al Ain
    Beans
    7,909

    Re: How to create swap file on ext4

    Do yourself a favour and read:
    $ man swapon

    It is all explained nicely in there.

  5. #5
    Join Date
    Apr 2010
    Beans
    258

    Re: How to create swap file on ext4

    sorry every one as far as I understand it is using custome kernel 3.4.0 #1 SMP Fri Apr 11 19:07:10 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux that can not use swap (at least that is what I think and @psusi from askubuntu is the problem)

  6. #6
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    8,050
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: How to create swap file on ext4

    Chromebooks are running on ARM architecture with solid state memory, so perhaps swap capability was removed from that kernel to save wear-and-tear. You could recompile with swap capability added back in and use a USB stick for your swap location, in case swap really does trash the memory.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

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
  •