0

I want to create a file system image for a foreign Linux system on a local Linux.

First of all, the foreign system could have different CPU architecture, such as ARM, MIPS, rather than my local PC Linux host. And it does not currently support virtualbox simulation.

Secondary, the foreign system could have users different than my local host, and possibly has same user ID but may be in different name, or possibly a user ID only exists in the foreign system but not the local host.

Similarly for the group IDs.

A normal file system creation process, including to create an empty file system image, mount it, copy files into it, and then ummount it.

The problem is, since the user ID does not exist in my local host, how do I create it in my local file system in the copy file stage?

We know that if we tar some folder in the foreign system, and then un-tar it in my local host, I can get some files with non-existing users/groups in place. This proves that files with non-existing users/groups can exist in Linux system.

Robin Hsu
  • 103
  • 4

1 Answers1

1

In the Filesystem UID and GID are stored. One can also chown UID:GID instead of using chown user:group to set file permissions to non-existent local users/groups. So the creation of the files should be easy.

Even better would be to create users/groups on the local system with specific UID/GID matching both systems. useradd & groupadd support that.

hargut
  • 3,848
  • 6
  • 10
  • 2
    You are right. I also found `install` command can do the same (even better since it do both ownership and permissions at once.) – Robin Hsu Oct 29 '18 at 07:14