Closed zhouruixi closed 7 years ago
I think that's a great idea.
Please reply with your USB drive UUID setup process :smiley:
Then I will test it. If successful add it to the McDebian rootfs Wiki and firmwares.
The idea is good, but if the disk fails, you won't be able to connect any other drive. And you're going to have to prepare a new kernel with a new UUID.
My USB KEY is /dev/sdb on my computer. If the UUID of kernel cmdline is set to "86488f88-730d-43d2-8a60-3e3a82d9573e"
#mkfs.ext4 -U 86488f88-730d-43d2-8a60-3e3a82d9573e /dev/sdb1 # blkid /dev/sdb1 /dev/sdb1: UUID="86488f88-730d-43d2-8a60-3e3a82d9573e" TYPE="ext4" PARTUUID="d10f7095-01"
# blkid /dev/sdb1 /dev/sdb1: UUID="32fedb62-4e10-4954-bb3a-56dd39a96299" TYPE="ext4" PARTUUID="d10f7095-01"
# tune2fs -U 86488f88-730d-43d2-8a60-3e3a82d9573e /dev/sdb1 # blkid /dev/sdb1 /dev/sdb1: UUID="86488f88-730d-43d2-8a60-3e3a82d9573e" TYPE="ext4" PARTUUID="d10f7095-01"
You can change rootfs's UUID to anyone with "tune2fs -U UUID". You can get a random UUID with "cat /proc/sys/kernel/random/uuid".
Oh, I did not know that I could change the UUID.
@zhouruixi thanks for the instructions. I will test them out and reply with results.
@Chadster766 Does it working on your test? I'm looking for your result.
Sorry I haven't tested IT yet :-)
I tested and it works. @zhouruixi I'm guessing you have a WRT1200AC, the firmware with the command line change is listed below.
http://www.protechs-online.com/downloads/McDebian/firmwares/McDebian-WRT1200AC-V1-FW_VER1_kernel_4.9.31_uuid_c58bfc9b-6399-4bdd-b5cf-97cc69a3cd49.img
Changes to the process:
My testing seems to indicate that a rootfs with these changes will boot with the standard McDebian firmware but that firmware with the kernel command line changes won't boot without the GPT and GUID changes to the USB drive partition table.
@Chadster766 Thanks for your working, I'll try it later.
Yes, It works well. I had read init/do_mounts.c and I know that should use PARTUUID instead of UUID.
Thank you!
I'll close the issue. @Chadster766
When I plug my cz80 USB KEY(as root of mcdebian) on usb2.0, and plug my mobile hard disk on usb3.0, the kernel show me cz80 is sdb not sda.
So, how about change kernel-command-line "root=/dev/sda1" to "root=PARTUUID=A special UUID", and we just need use tune2fs to set the rootfs's UUID to the specific UUID, then the kernel will always find the correct rootfs.