I’m trying to install Ubuntu 16.04 alongside with Windows 7. My HDD supports only 4 partitions. Three of the partitions are taken up by windows. The fourth one is labelled as free space.

Now, how do I make root, swap and home partitions? Should I format my free space as primary with EXT4 first (if so, what should be the mount point?) and then create logical partitions for root/Home/swap? How do I go about this?

Edit: I tried to use the automatic installation option for dual boot. However I got the error ubi partman exit code 141. Probably because it tried to create two separate partitions for root and swap.

$ sudo parted -l
Model: ATA ST1000DM003-1CH1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  106MB  105MB  primary  ntfs         boot
 2      106MB   277GB  277GB  primary  ntfs
 3      277GB   903GB  627GB  primary  ntfs
  • 2
    You want one primary partition as the extended partition and then can have an unlimited number of logical partitions inside the extended. Post this: sudo parted -l Do not create partitions with Windows as it may convert to its proprietary dynamic partitions from standard basic partitions. If you do not have 4 primary, skip the first part: askubuntu.com/questions/149821/… – oldfred Nov 5 '17 at 17:01
  • first of all, backup all your personal data on external hard drive. Delete one of the partitions (D, E, etc. Not C) after deleting it you can make two primary partitions. Make one of them as Extended, in extended you can make several partitions. One of those several partitions can be your old partition you formatted, swap for Linux, Home for Linux, etc. and your second primary partition can be Root for Linux. good luck! – Edward Torvalds Nov 5 '17 at 17:06
  • Added output of parted -l. Deleting windows partition is not an option for me. I have a single partition left with around 90 GB free space. – Heethesh Nov 5 '17 at 17:17
  • @oldfred I'm using a desktop with 16GB RAM. How much of swap size would you recommend? Keeping 20GB for root. – Heethesh Nov 5 '17 at 17:36
  • Either 2GB for swap or none. I like to have just a little as system seems to want to find it. But if 17.04 or later it uses a swap file, but will use a swap partition if found. If system has 16GB of RAM, sounds like a newer UEFI system, so why the 35 year old BIOS/MBR configuration? – oldfred Nov 5 '17 at 21:08

In a new installation of Ubuntu 18.04 there is no need for either home or swap partitions and creating them is a waste of disk space. One ext4 partition for everything is all you need. This answer would also have helped you in Nov. 5, 2017 because starting in new installations of Ubuntu 17.04, the Ubuntu installer creates a swap file instead of a swap partition by default, so a single partition is all you need.


In addition to the @karel's answer, here is how to setup swap-file on the previous Ubuntu versions, as 16.04:

sudo fallocate -l 16G /swapfile # Create a 'swap-file'; 16G in this case
sudo chmod 600 /swapfile        # Set the necessary file permissions
ls -lh /swapfile                # Check
sudo mkswap /swapfile           # Mark the file as 'swap'
sudo swapon /swapfile           # Enable the 'swap'
sudo swapon --show              # Check
free -h                         # Another check

Edit /etc/fstab and make the changes permanent:

sed 's/^.*swap.*$//' /etc/fstab -i.bak # Remove the previous swap related entries 
                                       # and create a backup copy of the file
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab # Add a new entry

Or edit /etc/fstab and add the the following entry manually:

/swapfile none swap sw 0 0

Ideas for additional tweaks (I would prefer to use the default settings for normal swap usage):

  • Change the frequency of RAM to SWAP data copy:

    sudo sysctl vm.swappiness=10    # value 0-100: low value low frequency
    cat /proc/sys/vm/swappiness     # Check
  • Change the frequency of Cache flush:

    sudo sysctl vm.vfs_cache_pressure=50 # 0-100: high value high frequency
    cat /proc/sys/vm/vfs_cache_pressure  # Check
  • Make the above changes permanent:

    sudo cp /etc/sysctl.conf{,.bak} # Create a backup copy of the file '/etc/sysctl.conf'
    echo -e '\nCustom settings: value 0-100; default 100\nvm.swappiness=10\nvm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf

    Or edit /etc/sysctl.conf and add the the following entries manually:

    # Custom settings: value 0-100; default 100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.