Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have cloned my linux OS onto a new hdd. Now even tho the system will boot, it directs me to the login screen and asks me to fix the location of the root dir because it is looking for /dev/disk/by-id with a very long serial #. I presume this is the old hdd serial #. How can I determine the serial # of the new hdd and change it in fstab? Is this the correct idea? Is it just......ls /dev/disk/by-id???
Look at "ls -l /dev/disk/by-id/". They are symbolic links to device nodes like /dev/sda1, /dev/sda2, etc.
Follow the links and use the new by-id names in /etc/fstab and /boot/grub/menu.lst.
The ID names are created by the kernel and contain the drive serial number, which changed. You may be able to globally replace the old drive serial number with the new one (e.g. in vim) leaving the rest of the id # entries the same (since you cloned the drive).
Well, I didn't know that about the kernel. What I did was just delete all references to /dev/disk/by-id and replaced it in fstab with the actual location:
/dev/hda1 /dev/hda2 etc.
Then everything worked fine. Can you explain the advantage of leaving all the serial ## gobbledegook in fstab. It seems cleaner to me to just put the location. Maybe I can get a better result if I use the /dev/disk/by-id???
Thanks
Last edited by palmweaver; 01-24-2010 at 09:34 PM.
I know this thread is like 10 years old now, but I think the answer is still relevant, and may help somebody...
The reason to use UUID or LABEL in your /etc/fstab is because device names can change over time. For instance, your boot volume may be /dev/sda1 when you set it up, but if you plug in a usb drive and reboot, the drive that contains your boot sector could become /dev/sdc1. Device name is assigned at boot time, and can change. Using UUID and LABEL can force the volume to be mounted where you want (and need) it.
Last edited by saigelosli; 04-22-2020 at 01:50 PM.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,800
Rep:
Quote:
Originally Posted by saigelosli
I know this thread is like 10 years old now, but I think the answer is still relevant, and may help somebody...
The reason to use UUID or LABEL in your /etc/fstab is because device names can change over time. For instance, your boot volume may be /dev/sda1 when you set it up, but if you plug in a usb drive and reboot, the drive that contains your boot sector could become /dev/sdc1. Device name is assigned at boot time, and can change. Using UUID and LABEL can force the drive to be mounted where you want (and need) it.
Depending on your chosen distribution, you're almost certainly able to label the boot partition (along with any others that you create during the installation process) and inform the installer to mount by label. That way, the /etc/fstab file that is created will have the "LABEL=" set up automatically. It's usually not available using a.) the "easy/quick" installation method or b.) the default method of building the filesystems and /etc/fstab---you might have to go to an "advanced" option when installing and laying out the filesystems. It's a pity since Linux's behavior changes device names depending on what's seen (and when) during the boot process. It's not just normal filesystems: you may note errors during the boot process that involved swap partitions that "moved" from naming changes. Fortunately, swap partitions can have labels, too. (And that `swapon' is smart enough to avoid mounting a regular filesystem as swap space.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.