Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I initially made a 13 gig partition for my Ubuntu installation and that running out of space. Also I originally gave half my disk space to windows 7 which I hardly use.

I wish to erase everything - give windows about 20% (begrudgingly) And increase my Ubuntu share. I wish to

  1. copy my 13 gig installation to a usb flash.
  2. Re-partition
  3. copy back the ubuntu to the increased partition.
  4. update grub2

Question: Is it just a question of booting into a live-distro selecting my 13 gig ubuntu and dragging it over to my usb flash? Or do I have to worry about things like sym-links etc?

Any other hints will be appreciated.

share|improve this question

2 Answers 2

A better choice would be to use a tool (such as the partition editor that comes with Ubuntu) to resize both partitions. Basically, you shrink the Windows partition, then scoot Ubuntu over into the space freed and resize the partition to take up the extra room. This keeps everything installed, you don't have to worry about copying to/from a flash drive, and it's faster (done correctly).

Ubuntu actually has a good write-up about how to do this. Also look at this How-To Geek article if you'd like some screenshots (it's older but still valid). Lastly, the GParted FAQ talks about this operation.

Two points: First, Particularly important is to reboot Windows immediately after shrinking its partition. Its bootloader is more fragile than GRUB's or other Linux bootloaders' default setups. Second, if it makes you feel more comfortable, you can use Windows's own partitioner tool to have it shrink its partition--you can have it do this while Windows is running.

Good luck!

EDIT: It should go without saying that you should back up any precious data. You're modifying filesystems here!

share|improve this answer
    
Sorry, I already know how to do this, I have more partitions on my drive than you realize. I have been resizeing and shrinking and adding partitions for too long. It is time for clean-up. –  Simon James Sep 16 '13 at 17:46
    
My Windows Partition and my ubuntu are not next to each other. –  Simon James Sep 16 '13 at 17:49
    
The basic idea still works; just delete the old, unused partitions. And it doesn't matter if they're next to each other or not. If you're moving the Windows one around, though, miight be better to let it do it itself, rather than try Gparted. At any rate, good luck. –  thirtythreeforty Sep 17 '13 at 0:25

Yes, you do need to worry about symlinks, permissions, etc. Easiest in my book is to use rsync. It can handle symlinks and permissions, plus can resume if interrupted.

To copy to your usb:

sudo rsync --archive --hard-links --one-file-system / /path/to/USB/backup

To restore, you'd have to boot a livecd to rsync to an empty partition (can't copy Linux over itself!), and update /etc/fstab accordingly. If /home or /boot is on a separate partition, you will need to run it again on those folders.

share|improve this answer
    
Thanks, just a question: the man on rsync says -a(--archive) does not preserve hardlinks, because finding multiply-linked files is expensive. You must separately specify -H? or does the --one-file-system command solve this problem? –  Simon James Sep 16 '13 at 17:48
    
@SimonJames wow, I missed that! You do need to add -H; --one-file-system only prevents rsync from iterating through the USB device you're backing up to. I'll update my answer. –  SlightlyCuban Sep 16 '13 at 17:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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