Announcement

Collapse
No announcement yet.

repartitioning

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    OG, glad you got where you wanted to be. Sometimes the best solution is the quickest one to success!

    Originally posted by Teunis
    Heh, oldgeek you are not the only one who learned, I listen when the likes of oshunluvr talk

    About disk label vs. ID, in my laptop I use a caddy and can put different disks in it.
    Here it's very convenient when the system just picks up the /dev/sdb1 disk instead of wondering about a new ID.
    Thanks for the compliment. Most of this topic I learned about the very hard way - weekends of re-arranging, partitioning, moving drives about, losing data, etc. Now I primarily use btrfs which eliminates a lot of the work.

    I can see where with caddy using the device name would be the better choice.

    On a single disk system with very basic and stable partitioning, there's no or little advantage to UUID labeling. However, in a multidisk environment or on a PC where you regularly add and subtract disks or even partitions, UUIDs can be major work-savers. Moving a disk from sda to sdf and then adding three partitions to it ahead of a bootable partition - making it partition 6 instead of 3 for example, would change /dev/sda3 to /dev/sdf6. In a testing environment like mine (ok, playground might be a better word ) If this partition is being accessed from 3 or 4 other installs and 2 different GRUB installs - they all have to be edited. If you're using UUID - then none need to be edited. Obviously, UUIDs are much better in a case like mine.

    The only time a UUID changes is when you reformat. In some cases - swap partitions being one of them - this causes problems. For instance, 3 or 4 different installs all using a single swap. In this case, if you needed to recreate your swap partition, (moving it to a different disk or changing its size), copy the current UUID, use the -U switch with mkswap and use the same UUID (example below). Then all your installs need no editing - they will all use the new swap without any other changes. Neat huh?

    Saving your swap UUID (terminal commands in bold):

    Before deleting the old swap, get the UUID:

    SWAPUUID=`sudo blkid -c /dev/null -o list |grep swap | awk '{ print $4 }'`

    The above command is chock full of neat little bash tricks. The blkid options put the UUID info in columns and makes sure it's current. The grep command eliminates all the UUIDs except the swap partition. The awk command leaves only the UUID. And finally, the SWAPUUID=` ` puts the UUID neatly into a variable for later use. Note that bash variables of this sort would not survive closing the konsole session.

    Next you would turn off the swap;

    sudo swappoff -a

    Now delete the current swap partition using your tool of choice (fdisk for me) and create a new one. Then make the new swap partition using the previous UUID

    sudo mkswap -U $SWAPUUID /dev/sdXX

    and that's it! No editing of several fstabs or having all your install stall during boot looking for a swap partition.
    Last edited by oshunluvr; May 11, 2014, 10:14 AM.

    Please Read Me

    Comment


      #17
      Originally posted by Teunis
      ... eventually I found out they both had the exact same ID
      Yes, I've done that, worth emphasising IMO:
      If you copy a partition, you've copied the UUID, your system is in an invalid state. Either destroy the source, or remove a device, or set a new UUID on one of the copies.

      Regards, John Little
      Regards, John Little

      Comment


        #18
        Yeah, you have to change the UUID if you're going to mount the backup at the same time as the original. I wonder if you mount by dev name instead if it will work?

        Please Read Me

        Comment

        Working...
        X