Search code examples
unixmergedebiandisk-partitioning

Easiest way to merge partitions under debian (unix)?


I have two unix partitions under debian which I would like to merge (disk space problems :/). What would be the easiest way to do it? I think it would be best to tar or copy files from one partition to the other, delete one and resize the other. I will use parted to resize but how should I copy the files? There are links, permissions and devices which need to be moved without change.


Solution

  • You could run the following (as root) to copy the files. It works for symlinks, devices and ordinary files.

    cd /partition2
    tar cf - . | ( cd /partition1 && tar xf - )
    

    Another way is to use cpio, but I never remember the correct syntax.