5

I have installed ubuntu on a 8GB 5GB partition. As I have installed many packages, I am running out of space.

Qn 1 : Is there a way that I can specify another portion for installing the packages ?

Qn 2 : Can I move the whole installed files from my current partition to another place ( partition ) and make the changes in grub or so?

I don't want to reinstall the whole, so after that I just can make an upgrade :-)

The / , and home directory is in same place.

Thank you .

0

1 Answer 1

4

A1: no, it's not possible. The paths are fixed.

A2: if you want to move files to another partition, you'll need to use a Live CD. Please consider resizing partitions first which is much easier and less error-prone. This is only possible if you've enough space on one disk. Consider moving your /home folder as described here too, 8GB should be enough for / in most cases. If you want to use a second disk as root partition or wish to create a new partition on the current disk, please continue.

  1. Make a backup (preferably with disk-cloning software like Clonezilla).
  2. Boot into the Live CD, do not mount anything
  3. Create a new partition using the Disk Utility or GParted. This partition must support Linux file permissions. Such a filesystem is ext4. Label it "UbuntuRoot" so you can find the partition easier, otherwise you'll have to remember the partition name (e.g. /dev/sdb1)
  4. Open a terminal and run sudo blkid to get the UUID for your newly created partition. Example output, you'll need the last line:

    /dev/sda1: LABEL="HDD" UUID="AD078BC9C024FCDD" TYPE="ntfs"
    /dev/sda2: LABEL="DATA" UUID="FDE43758913E70EE" TYPE="ntfs"
    /dev/sda3: UUID="a88638ae-3cd3-45c0-ad06-2d56d89b19a0" TYPE="swap"
    /dev/sda4: UUID="e3f848cb-5a05-4d2d-92e0-3eaf7b27338c" TYPE="ext4"
    /dev/sdb1: LABEL="UbuntuRoot" UUID="1cdfadcf-0969-48ba-96a5-42557c23f8e9" TYPE="ext4"
    
  5. Mount your old root partition (/dev/sdb1 is your newly created partition, /dev/sda4 was your old partition):

    sudo mkdir /media/old
    sudo mount /dev/sda4 /media/old
    sudo mount /dev/sdb1 /mnt
    
  6. Copy over the files (this may take a while):

    sudo cp -prvT /media/old /mnt
    
  7. Update /mnt/etc/fstab with the new UUID. Pick an editor at your choice:

    sudo nano /mnt/etc/fstab
    gksu gedit /mnt/etc/fstab
    

    Find the line that looks like and replace the UUID of /dev/sda4 with the /dev/sdb1's UUID:

    # / was on /dev/sda4 during installation
    UUID=e3f848cb-5a05-4d2d-92e0-3eaf7b27338c /               ext4    errors=remount-ro 0       1
    
  8. Save /mnt/etc/fstab and exit the editor. Next, GRUB needs to be updated to boot from the new disk and partition.

    sudo grub-install --root-directory=/mnt /dev/sdb
    
  9. Unmount the partitions to finish it:

    sudo umount /mnt /media/old
    
  10. Reboot to check the result.
14
  • Thank You for your quick reply on it. I will try and write the experience :-)
    – Hari K T
    Jul 23, 2011 at 16:44
  • It was 5 GB only, not 8 GB.
    – Hari K T
    Aug 14, 2011 at 3:43
  • 5GB is a bit low but will suffice if you're cleaning files regularly (sudo apt-get clean to clear your APT caches, browser cache). I've a fresh development installation here using only 3G including a /home of 200MB.
    – Lekensteyn
    Aug 14, 2011 at 8:37
  • Sorry man , I went into trouble . Not sure how I lost my bootloader . And it was coming in the grub-rescue> terminal ( Before I tried your steps). But I went with the USB and tried your steps hoping the bootloader will install it. But all the error came when I tried to install the bootloader . I tried different ways . In yours it says root, but in the help I see boot , so to conclude these were the errors pastie.org/2370460 . But I had a fresh install on another partition . So now I have 2 Ubuntu :) . Anyway as the data is safe I am happy with it.
    – Hari K T
    Aug 14, 2011 at 13:36
  • Read the manual if you're not sure what an option is used for. --boot-directory sets the location in which GRUB's files are placed. By default, this is /boot/grub (/mnt/boot/grub). I assume /dev/sda11 is your target partition? Otherwise, could you post the output of sudo fdisk -l and sudo blkid?
    – Lekensteyn
    Aug 14, 2011 at 13:43

You must log in to answer this question.

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