tar gotcha when migrating disk

Over the years, I have changed 2.5" hard-drives in laptop more often than I want to remember. Last one lasted only year and a half, which is noticably less than previous ones which managed to survive for two and half years at least.

But, this time, I didn't manage to find two 2.5" HD adapters for desktop PC, so I opted to use netcat and tar like this:

new$ nc -w 5 -l -p 8888 | tar xvfSp -
old$ tar cfvSp - / | nc new 8888

Can you see the touble here? (No, I'm not thinking about redundant S in one of tars -- hack, I'm not even sure it's redundant, man page didn't tell me anything useful).

If you couldn't guess, I didn't have completly same /etc/group and /etc/passwd on both machines. Life sucks. I should have used --numeric-owner for tar and all would be well, thus here is a blog post...

Update: if you are using framebuffer, leaving v flag will slow down transfer considerably because screen scrolling is slow. So, faster and correct alternative is:

new$ nc -w 5 -l -p 8888 | tar --numeric-owner -xSpf -
old$ tar --numeric-owner -cSpf - / | nc new 8888