Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently, I have Ubuntu 12.04 set up with the following partitions:

500G disk with LVM
  80GB root
  4GB swap_1

I want to move the folder /opt to a new LV, for example:

500G disk with LVM
  root (80GB)
  swap_1 (4GB)
  lv_opt (200GB)

What is the right way to do this?

share|improve this question
up vote 0 down vote accepted
  1. Go to single user mode to be on the safe side - telinit 1
  2. Create opt_lv
  3. Format opt_lv
  4. Mount opt_lv on /mnt
  5. Copy and retain all attributes (archive move) cp -a /opt/* /mnt/*
  6. umount /mnt
  7. rm -rf /opt/*
  8. Add fstab entry to mount opv_lv on /opt
  9. mount /opt
  10. Go back to multiuser - telinit 3
  11. Done!
share|improve this answer

If everything in /opt is static, which is probably should be, just copy everything to the new partition with rsync or dd or whatever and then modify /etc/fstab to mount the new partition as /opt and reboot.

If it's not static content, you can either stop anything that would be writing to it before the copy, or just boot into single-user mode and do the copy to be safe.

share|improve this answer

Your Answer


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.