On Mon, Oct 19, 2015 at 05:59:15PM +0300, Ivan Boro wrote: > Looks like subj. > Have a KVM machine with jessie assembled via debootstrap. Fstab states > > /dev/vda2 / ext4 rw 0 0 > > The partition labeled vda2 is listed in grub.cfg as the > root partition by its uuid.(via update-grub) > > Added a disk to have swap on it. Booted normally, despite > the fact, that the new swap-disk was automatically labeled > as vda and the disk with root is as vdb: > > # mount | grep ' / ' > /dev/vdb2 on / type ext4 (rw,relatime,data=ordered) > > So, systemd mounted root partition, whitout looking into fstab. > > I don't have much experience in systemd, and now wonder how > this "smart" mount works.
This isn't a systemd "trick", but rather the job of the initrd/initramfs. Back in the good old days, finding the root filesystem was easy (it was /dev/hdaX, or possibly /dev/sdaX if you were on a server with a SCSI card). Nowadays, with LVM, RAID, encrypted file systems, iSCSI etc etc, there are times when the kernel can't mount the root filesystem by itself. So distributions (such as Debian) use an "initial ram disk" to help find root. This consists of a single disk image which is provided to the kernel by the boot-loader. The disk image contains several tools to "discover" where the root file system is and mount it at a known point. When the tools on the initrd are done, the kernel switches to that new root file system and continues boot. Now, you mention that you told grub that root is at UUID=xxxx. This will be passed to the kernel and the initrd scripts will pick up on that. So your root filesystem is mounted by UUID. When you think about it, it has to be. /etc/fstab is on your root filesystem. How do you read that file without knowing where the root filesystem is? > > Ivan Boro > -- For more information, please reread.
signature.asc
Description: PGP signature