LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Swap partition UUID changed. What do I do? (https://www.linuxquestions.org/questions/linux-newbie-8/swap-partition-uuid-changed-what-do-i-do-812263/)

searcher1 06-05-2010 01:15 AM

Swap partition UUID changed. What do I do?
 
Someone (not me) recently installed some new distros on my HD. It seems that during the installation my swap partition was reformatted and a new UUID was assigned to it. I have the following questions:

1. I know that I have to change the swap partition UUID in /etc/fstab and /boot/grub/menu.lst of the affected distros. Is there anything else that needs to be changed?

2. I presume a similar change has to be made to the Grub 2 configuration, for those distros that use Grub 2. I have no experience using Grub 2 so how do I make the change or where can I find instructions to do it?

Any help would be greatly appreciated. Many thanks.

syg00 06-05-2010 01:54 AM

You let others screw around with your system(s) ?. Hmmm ...
This is one of the reasons I avoid UUID.
1) no - but you could revert to device nomenclature and save future heart-burn.
2) read this.

GlennsPref 06-05-2010 02:00 AM

Hi, I found this just the other day. It eventually talks about resetting the uuid/'s with a script.

http://www.linuxquestions.org/questi...4/#post3971949

which leads to this script, which I have not tried yet.

http://barjac.pastebin.com/raw.php?i=f2d0a3e3a

Cheers, Glenn

craigevil 06-05-2010 02:01 AM

run blkid as root and make sure the fstab entries match what it outputs.

searcher1 06-05-2010 03:14 AM

Guys, thanks for the replies. You have been most helpful.

@syg00,

Quote:

1) no - but you could revert to device nomenclature and save future heart-burn.
2) read this.
How to use device nomenclature? I could really do with this since other people are messing around with my computer. I looked at the Grub 2 files mentioned in the article but none of them refer to the swap partition. I therefore take it I don't need to make any changes in Grub 2, only in fstab.

@Glenn,

I think those links refer to Legacy Grub, since they make reference to menu.lst. I tried the script of the first link in Mint and it didn't work. I did run the script on those distros that use Legacy Grub and they show "Root and swap UUIDs as expected by initrd". Thanks for the tip.

@craigevil,

Thanks for letting me know about blkid. I ran it and matched the fstab entries.

Once again, a very big thank you for all the help. It looks you have helped me solve my problem.

syg00 06-05-2010 03:38 AM

The blkid will give you the device (/dev/sda?) - just stick that in place of UUID=<blah>

searcher1 06-05-2010 04:13 AM

syg00, thanks. That's what I did.

saikee 06-05-2010 05:33 AM

The /dev of the Linux list out the device names as well as the UUID codes.

Therefore you can just do a "fdisk -l" to find which partition is a swap (Type 82) and select either the /dev/sda? or uuid code.

Here is what it looks like in directory /dev/disk/by-uuid
Code:

[root@localhost saikee]# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 01031e7e-e80b-4957-9542-bf537c71e907 -> ../../sda33
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 0186b384-6244-430a-8194-619fdf9e016d -> ../../sda32
lrwxrwxrwx. 1 root root 10 Jun  5 10:39 024226c4-1361-414c-bbef-e24f077f5b70 -> ../../sdb5
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 0cb8b7d6-ba71-4346-9301-63f59decda96 -> ../../sda38
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 13d68126-0b75-4149-8860-1e09fc951b81 -> ../../sda37
lrwxrwxrwx. 1 root root 12 Jun  5 10:39 1687c1df-3c09-41d0-95c9-fe8d94123b81 -> ../../sdb128
lrwxrwxrwx. 1 root root 10 Jun  5 10:39 1eba97a1-e188-4818-a162-6fb6652e9444 -> ../../sdb4
lrwxrwxrwx. 1 root root 10 Jun  5 10:38 24C8CF551DEBD00F -> ../../sda8
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 2a746927-2052-4323-83a5-f65a8d4e8e04 -> ../../sda57
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 2d31920c-cef2-482b-82a4-e2a8426791c5 -> ../../sda20
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 39b16301-02d1-48c6-a543-be9253d0a82f -> ../../sda48
lrwxrwxrwx. 1 root root 10 Jun  5 10:38 3EB20A14B209D177 -> ../../sda7
lrwxrwxrwx. 1 root root 10 Jun  5 10:38 4485-0D05 -> ../../sda1
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 44a303c7-f0e8-477d-bc8c-66895250a5e8 -> ../../sda25
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 53438f84-ab4c-4eb1-8cfb-1086531b1b32 -> ../../sda55
lrwxrwxrwx. 1 root root 10 Jun  5 10:38 5C91-5660 -> ../../sda2
lrwxrwxrwx. 1 root root 10 Jun  5 10:38 60C1A35237300847 -> ../../sda6
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 707a8f99-dd08-466e-ae54-89a59cc08af2 -> ../../sda39
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 71a0686d-4516-488a-8a09-83c572af974b -> ../../sda12
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 72108dcf-7aab-41b0-a821-e00ccd77b567 -> ../../sda29
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 74ff1211-7eba-44c4-a5ed-b13e7ca4ed47 -> ../../sda16
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 7a859653-edca-42cf-af64-24301879b515 -> ../../sda27
lrwxrwxrwx. 1 root root 10 Jun  5 10:39 7b221fb7-de56-4b1f-854a-c78122b63d31 -> ../../sdb1
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 7b95a45d-233d-4073-b80a-90944124c1f7 -> ../../sda54
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 7bd3aa70-f082-4320-bb58-6e9f35490ef5 -> ../../sda40
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 7ca97154-59a2-48ea-8326-fb5e3e18fa0b -> ../../sda15
lrwxrwxrwx. 1 root root 10 Jun  5 10:38 8824CAEB24CADAF8 -> ../../sda9
lrwxrwxrwx. 1 root root 10 Jun  5 10:38 8a64f1dd-6e31-4dcd-9d01-b4563fc080eb -> ../../sda5
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 90F6A961F6A94874 -> ../../sda10
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 9100d491-5675-4c02-b41e-edf62f7ce286 -> ../../sda17
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 9101f3ad-4f67-4673-a0fc-b95893937931 -> ../../sda47
lrwxrwxrwx. 1 root root 11 Jun  5 10:39 96C8CF03C8CEE09B -> ../../sdb21
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 9966af15-3a49-4abb-a181-9d6146974e99 -> ../../sda36
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 a071ca8b-5d9d-4866-83b4-45d8e788a669 -> ../../sda19
lrwxrwxrwx. 1 root root 10 Jun  5 10:39 a1393b8d-69c0-4df6-95b8-c266d2667065 -> ../../sdb3
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 a5470443-506f-4057-a00f-2ccf4e159fbc -> ../../sda34
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 a57875f2-777e-4319-a088-9d86949a53f9 -> ../../sda44
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 af751e83-b662-41de-a1dc-d3f1124a7aa6 -> ../../sda58
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 af799de0-2b12-4179-be0d-a024ce8604c6 -> ../../sda26
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 b2aaa31b-5fd4-4555-b122-2a91d5176ce8 -> ../../sda43
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 b33f79b7-2c0e-42f5-a459-f16e71f4c397 -> ../../sda51
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 b5bc0952-f597-4a62-b8f1-952757e5fb9d -> ../../sda53
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 bf5b68ac-be0e-4b86-a036-d8b0fdc0cc67 -> ../../sda31
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 c4db6269-dd5f-41a1-89a3-e901c89d7a52 -> ../../sda13
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 ca017615-088c-4baa-934c-69f0ed380020 -> ../../sda18
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 caedede4-af0c-4889-9c5c-55ae2efbc051 -> ../../sda52
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 cce10e76-acc1-4866-8c22-c8cceaf56e00 -> ../../sda28
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 d7923ad0-abcd-42d0-a29d-80080b9ee390 -> ../../sda11
lrwxrwxrwx. 1 root root 10 Jun  5 10:39 d7bd8f5b-b373-4794-82a2-e052b92b8694 -> ../../sdb2
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 dcb1fe18-33a1-4db2-9935-52fb121efca2 -> ../../sda56
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 dd65c379-c3b5-4f6b-a991-783afb144cfd -> ../../sda46
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 e2727b63-6845-4776-8be0-73bf3b685877 -> ../../sda14
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 e3d86ddc-ad1e-431c-9ef5-83987b967c18 -> ../../sda21
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 e91478f7-563c-4aa6-bf8f-22b79c3922f1 -> ../../sda41
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 ee7df8b3-d388-44fd-844c-14a8b7af9000 -> ../../sda49
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 ee9a538d-c2b3-40a6-adff-68ec00639b28 -> ../../sda42
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 f3225d83-c47f-4d48-a080-67dd0d32b35b -> ../../sda30
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 f70fd015-0d47-4632-9dc5-a63588896e71 -> ../../sda45
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 f9fa503c-53d7-4bbf-9011-12c81b44364f -> ../../sda59
lrwxrwxrwx. 1 root root 11 Jun  5 10:38 fcc6a37f-0c93-45cf-9e21-35d6be725042 -> ../../sda35
[root@localhost saikee]#


searcher1 06-05-2010 07:32 AM

saikee,

Thank you for the reply. My HD is nowhere as complicated as yours! I know my swap is in /dev/sda2. This is the relevant part of my fstab for my Mint partition:

Quote:

# / was on /dev/sda9 during installation
UUID=7b4679af-0485-4089-ad81-51aa44413c6d / ext4 errors=remount-ro 0 1
# swap was on /dev/sda2 during installation
UUID=1a33c0d8-d83e-47ad-a4ac-d8c5e95f2544 none swap
If I remove the # on the two lines and put the # before the two UUID=, will it work?

saikee 06-05-2010 08:04 AM

All you need is to change the swap line from
Code:

UUID=1a33c0d8-d83e-47ad-a4ac-d8c5e95f2544 none swap
to
Code:

/dev/sda2 none swap
A # in the begining of the line is to take no action. It is generally used for explanation purpose.

searcher1 06-05-2010 08:14 AM

saikee,

Thanks ever so much! I'll get down to changing the fstab on all my distros asap. Do I make the change in the menu.lst in the same way?

saikee 06-05-2010 08:55 AM

Most distros do not have an entry in the menu.lst for the swap but a few use it for the resume purpose. Yes by all mean change back to the traditional Linux device names.

searcher1 06-05-2010 10:15 AM

saikee, I just edited the fstab and menu.lst on my PCLinuxOS, rebooted...and it works!!! You really are great! Thanks ever so much. With the confidence you have given me, I'll do the same for the other distros on my HD, at least the ones I installed. Once again, thank you.


All times are GMT -5. The time now is 09:03 PM.