5

In my notebook, I have a 16GB SSD and 1TB HDD. I have installed Windows 7 on the HDD, which consumes about ~250GB. Then I have installed Ubuntu 12.04.

I put / on the SSD with ~12GB and also the swap space with the rest of ~4GB. I put /home on the HDD with the rest of ~750GB. Unfortunately, I have just recognized that when installing programs, they are put on the SSD and I might run out of space pretty quickly.

How can I reorganize the partitions properly?

Here the output for df -h:

Filesystem          Size  Used Avail Use% Mounted on
/dev/sdb2            11G  5.8G  4.6G  56% /
udev                1.8G   12K  1.8G   1% /dev
tmpfs               724M  992K  723M   1% /run
none                5.0M  8.0K  5.0M   1% /run/lock
none                1.8G  260K  1.8G   1% /run/shm
/dev/sda3           686G  592M  650G   1% /home

fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00098003

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   493501558   246647355+   7  HPFS/NTFS/exFAT
/dev/sda3       493502464  1953523711   730010624   83  Linux

Disk /dev/sdb: 16.0 GB, 16013942784 bytes
255 heads, 63 sectors/track, 1946 cylinders, total 31277232 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x38b890f8

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     7813119     3905536   82  Linux swap / Solaris
/dev/sdb2         7813120    31275007    11730944   83  Linux

Disk /dev/mapper/cryptswap1: 3999 MB, 3999268864 bytes
255 heads, 63 sectors/track, 486 cylinders, total 7811072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x376be72b

Disk /dev/mapper/cryptswap1 doesn't contain a valid partition table
11
  • Delete the swap partition and allocate the space to the / then create a new swap partition in HDD. Jan 18, 2014 at 11:02
  • 3
    Actually you can make another partition on your HDD, and mirror the contents of /usr there. After that you can edit fstab and mount /usr/ from that partition, and delete it from the SSD. (All of this have to be done from a live CD/DVD environment.)
    – falconer
    Jan 18, 2014 at 11:16
  • 2
    I would like to suggest mounting /home and /usr/share from HDD which may get bigger? and keeping /usr/lib on SSD to load libs quickly.
    – user.dz
    Jan 18, 2014 at 11:23
  • 1
    @wasp256 Simple copying will break the proper permissions/ownerships so that won't work. You will have to mirror e.g with rsync or with cp -p. But I think someone will soon write a full answer with every aspects, just wait for it.
    – falconer
    Jan 18, 2014 at 11:54
  • 1
    Could you please put here output of this commands: df -h and sudo fdisk -l
    – c0rp
    Jan 18, 2014 at 12:55

1 Answer 1

2

Please, don't do anything until someone else reviews it. I could miss something.

As /home is already configured, move /usr/share

  • Using a live CD, start gparted
  • Unmount swap, lvm's and any mounted partitions
  • Resize the partition you like to get space from, apply

    If that partition is so big, try removing space from the end. So gparted will not shift the whole partition.

  • Create the needed partition as ext4, apply
  • Still using gparted: Right click on the new partition → Properties → Copy UUID
  • Mount the created (share) partition with the ubuntu partition which gonna copy from
  • Copy share folder. cp -a to preserve all (permissions, ownership, links..)

    Replace <ubuntu_part> and <share_part> with your partitions mounting paths

    sudo cp -a /media/<ubuntu_part>/usr/share/* /media/<share_part>/
    
  • Rename /usr/share as backup

    sudo mv /media/<ubuntu_part>/usr/share /media/<ubuntu_part>/usr/backup_share
    
  • Backup /etc/fstab

    sudo cp /media/<ubuntu_part>/etc/fstab /media/<ubuntu_part>/etc/backup_fstab
    
  • Same as /home add /usr/share, (use UUID copied before) something similar to:

    sudo gedit /media/<ubuntu_part>/etc/fstab
    
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sda1 during installation
    UUID=e3725608-ee2f-408d-9d53-4f172070ca1f /               ext4    errors=remount-ro 0       1
    # /home was on /dev/sda5 during installation
    UUID=1063be7e-2105-434c-a9e9-75cf3d02e969 /home           ext4    defaults        0       2
    # /usr/share was on /dev/sda6 during installation
    UUID=34c6fc4b-3c63-4e58-a3dd-3b70926c58c9 /usr/share      ext4    defaults        0       2
    # swap was on /dev/sda2 during installation
    UUID=bde0f592-e4fe-4eb6-9d75-eec161e349a1 none            swap    sw              0       0
    

    Lines starts with # are just comments

  • Reboot

  • If it's OK, delete backups

    sudo rm /media/<ubuntu_part>/etc/backup_fstab
    sudo rm -R /media/<ubuntu_part>/usr/backup_share
    

Note:

  • Disk Usage Analyzer (or du on command line) can be used get size info. It is more practical to analyze an already used system so all tools needed installed. So space distribution depends on user behavior, some install much -doc's, -dev's, wine programs in /home/user/.wine, ...
8
  • 2
    I think it's ok. Also i suggest to move swap partition to hdd, in our case to sda device.
    – c0rp
    Jan 18, 2014 at 16:26
  • 1
    Well, most users don't need much swap. Such case with big data processing. So I don't recommend removing it from SSD. Instead I would prefer resizing it, may be 1.0~1.5GB, and creating other one on the HDD. Otherwise you may monitor your extreme use if such size needed.
    – user.dz
    Jan 18, 2014 at 17:08
  • 1
    Everything worked just fine, thanks a lot for the help!!
    – wasp256
    Jan 18, 2014 at 19:08
  • 1
    You can remove swap totally and install zram. Read this article. After installing check it with cat /proc/swaps.
    – c0rp
    Jan 19, 2014 at 13:14
  • 2
    Also, if you do not want to move swap to hdd, at least i recommend to reduce swappiness – value about 1 to 10. It will prolong your SSD life.
    – c0rp
    Jan 20, 2014 at 6:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .