On Sat, 22 Jan 2022 at 18:42, lou <loushanguan2...@sina.com> wrote: > i've installed bullseye on usb disk > > can i copy it to hard disk (sda2) and make necessary change in > /etc/fstab and > > then update grub of usb disk to boot sda2?
Hi, in general this kind of thing is quite possible, and I would encourage you to try, and you will learn by doing that. However, there are a few potential problems that you need to be careful to avoid. First, it's best to try this first on a secondary system that you do not rely on for any other important tasks. That way you can experiment without fear of making mistakes. Related, the most important consideration for me would be that, if the usb disk is providing the root file system for a currently running operating system, then I would not attempt to copy that file system to another drive. Because that file system is being used for many things during the copy, and therefore it might be changing during the copy process, and so the copy process might not capture all of the changes. If that occurs, then the copy will differ from the original and might not work correctly. I would only ever copy any drive when it is not in use, to be sure that the copy is an exact replica of the original, and that the original did not change during the copy process. In the case of your question, that means at least 2 systems must be available, one to be copied and another one to do the copying. Another thing to consider is that the copy process must preserve any special attributes of the filesystem, which are likely to be essential to correct functioning of a root file system. So to achieve that might require the copy to be done using a special method. Many years ago when I first tried this kind of thing, I used to make all my root filesystem partitions have exactly the same byte count so that I could use 'dd' to guarantee a bit identical copy. But that is fiddly and inconvenient. For many years I have used 'rsync -haxv -HAXS -W --delete ...' and I have not had any problems that I have noticed, although it is complicated, see for example: https://unix.stackexchange.com/questions/118840/preserving-extended-attributes-with-cp-rsync and I have no expectation that such an 'rsync' command will copy any attributes set using 'chattr'.