Easiest way to merge partitions under debian (unix)?
I have two unix partitions under debian that I would like to merge (disk space problems: /). What's the easiest way to do this? I think it would be better to tar or copy files from one partition to another, delete one and resize the other. I'll use split files to resize, but how do I copy the files? There are links, permissions, and devices that need to be moved unchanged.
source to share
Since this is Debian with GNU fileutils, cp --archive
should work fine.
cp --archive --sparse=always --verbose --one-file-system --target-directory=/TARGET /ORIGIN
If for some reason you want to go through GNU tar
, you need to do something like this:
cd /origin
find . -xdev -depth -not -path ./lost+found -print0 \
| tar --create --atime-preserve=system --null --files-from=- \
--format=posix --no-recursion --sparse \
| { cd /target; tar --extract --overwrite --preserve-permissions --sparse; }
(I've done this so many times that I've gotten a file with all of these commands for quick reference.)
Warning: Using GNU tar
will not " " copy the POSIX ACL; you will need to use either the " cp --archive
" or " bsdtar " method :
mkdir /target
cd /origin
find . -xdev -depth -not -path ./lost+found -print0 \
| bsdtar -c -n --null -T - --format pax \
| { cd /target; bsdtar -x -pS -f -; }
source to share