I've got an Ubuntu install on a USB with a separate NTFS partition, can I expect the same UUID for the partition if I removed and reattached the USB to a computer?
Ubuntu – Constant UUID on USB install
partitioninguuid
Related Solutions
My guess is that you are not viewing/editing the same grub.cfg that the bootloader is looking at. Remember, you have two different /boot/grub
directories now, and the bootloader needs to know which one to look for. update-grub
is updating the grub.cfg in the currently mounted /boot/grub/grub.cfg
. I'm guessing that the bootloader is looking on the other partition. After I finish my first cup of coffee, I may be able to confirm this by following through your post and perhaps making notes, but right now it's got to be an educated guess.
I believe what you need to do is to run sudo grub-install --root-directory=/ /dev/sda
. I'm giving the full version for extra information - the --root-directory
parameter defaults to /
.
This command will reinstall the boot loader on /dev/sda, telling it to look in the "root-directory" parameter (/boot/grub) for grub.cfg. If you wanted your grub.cfg to be in a different distro, you can mount it and specify a different "root-directory", such as, for example, /mnt/my_other_distro/
if it were mounted in /mnt/my_other_distro
.
Let me know if you have problems while I drink my coffee. :)
Edit: (after coffee) I see now one important problem... you should have changed the UUID for sda1, not sda7. Then, when you installed Mint onto sda1, it would change it anyway if you reformat, but if you didn't change it, it might get confused. By changing the UUID for the old Ubuntu installation, you invalidated all the mount settings in its /etc/fstab, along with the GRUB menu. I assume Mint doesn't regenerate the menu, but only copies the entries, so it doesn't care whether it's correct or not.
Running update-grub corrects grub.cfg, but not the grub code in the MBR; this is changed only using grub-install.
And Linux Mint doesn't know what the entries in grub.cfg actually mean, as it may refer to a drive that isn't even present right then. It simply adds the new entry to the top of the existing ones, I think.
Lets take these in turn:
Disk Identifier:
This applies to an entire hard disk drive (not a single partition). A Disk Identifier/Disk Signature is a 4-byte number that is randomly generated when the Master Boot Record/Partition Table is first created and stored. The Disk Identifier is stored at byte offset 1B8 (hex) through 1BB (hex) in the MBR disk sector. Windows Vista uses the Disk Signature to locate boot devices so changing it can prevent Vista from booting. Apart from being able to display it I am not sure if this is used by Linux.
Vendor ID
Every USB device has a Vendor ID (VID), Product ID (PID) and optionally a serial number. The Vendor ID is intended to identify the manufacturer of a product: all USB devices from the same manufacturer should have the same VID irrespective of what they are so a mouse, a phone, a disk drive, etc. if made from the manufacturer should be the same.
Each manufacturer is supposed to assign a unique PID to each product they make so the VID:PID combination should uniquely identify a particular product (make and model) some manufacturers choose to assign unique serial numbers to their products but others don't so you can not use the VID and PID to uniquely identify a device because if you ever buy another one of the same make and model It will be the same. In addition some manufacturers have been known to use the same PID for different similar models. The output of the lsusb
command contains the VID:PID combination.
UUID
A UUID (Universally Unique Identifier) is a 128-bit number. UUIDs are used to identify many different things including some filesystem partitions. Where the UUID is stored for a filesystem depends on the filesystem. Linux ext2/ext3 and Windows NTFS identify filesystems by UUID. UUIDs are generated randomly using either the current time or a random number generator. The UUID is generated and stored when the filesystem is formatted and then does not usually change.
When you copy a partition or disk as raw binary data (for example, with "dd") the Disk Identifier or UUID is also copied. That can result in two disks or two partitions with the same identifier. There are utilities to change the UUID to a new (random) number. There are also utilities to change the Disk Identifier in the Master Boot Record.
The advantage to a UUID is that no matter where you move a filesystem, an operating system can find that particular filesystem. For filesystems that have no UUID the Disk Identifier can at least be used to locate the disk drive.
While it is possible to change the UUID in normal use this its unlikely to change.
Linux can use device names for partitions when UUIDs are not available. I would recommend using the UUID to identify your mount point.
To set the Mount point there are two options for drives that are permanently connected see the FSTAB -Community Documentation or for drives that are not always available if you are happy for it to appear as a subdirectory of /media/ but with a known name see RenameUSBDrive
A USB Drive can be formatted in lots of different formats. Many are formatted FAT by default because its a format that can be read by almost anything. But if this drive is only used on Linux it may be preferable to reformat it ext3 or ext4 see this question How to format a USB or external drive?
Best Answer
Usually the UUID of an external drive does not change. However under certain circumstances (e.g. by switching to another USB port) the UUID may become different.
Therefore we can mount drives using their label. Because we define the label by ourselves it will not change. However we need to take care to make unique labels for our drives.
Mounting by labels can also be done in the Fstab by adding a line similar to this:
To add or change a label we may use:
for FAT32:
for NTFS:
for ext2/3/4:
(adapt the values in the given examples to your system!). NTFS partitions can also be labeled with gparted.