[THE 1st TIME] Disk partitioning pt. 1
Posted: Mon Feb 24, 2014 2:37 am
The most scary part in every Linux installation is the disk partitioning. Enter the wrong stuff and your beloved #! gets deleted, and Windows does not boot anymore.
Let's see how a typical distrohopper's disk layout would look like:
As we can see, the /dev/sda5 is the 'root' partition, the one in which we are now, marked with the mount point '/'. We can also see that all other partitions are Linux installations. There is no swap space designated. Good guy! Is there a Windows installation? No, because we don't see "NTFS" listed as filesystem type.
And what is the partition where GRUB sits?
So, apparently /dev/sda1 is the partition that has the 'bootable flag', usually this is also the partition that is responsible for how GRUB looks like. It does not need to be the first partition of your drive. I could now, being in /dev/sda5, simply make this the boot partition (LinuxBBQ users can try the command "sudo grubrepair")
And how do I know what partition has what kind of Linux installed? A dirty trick:
This command first lists everything in /boot/grub/grub.cfg (the file that prints the GRUB menu on screen), then only shows lines that contain the word 'class', and then finally shows us only 80 characters of each line, for better readability. Of course you should read this from the actual boot partition, so in my case (/dev/sda1) I would first create a mountpoint (luckily I have one already)
and then read the file from there:
Clever people (who never really change the Operating systems in their partitions) can give their partitions some LABELs. I would give, for example, my /dev/sda5 partition the label "WORK", because I use this one mostly for, well, work.
and check the outcome. How? Read this post again from top to down ;)
Do this labeling with all your ext filesystem type (!) drives and partitions -- so everything that is ext2, ext3 or ext4, and you will feel a little bit more comfortable when you enter part 2 of this HOWTO :)
Let's see how a typical distrohopper's disk layout would look like:
Code: Select all
bbq@grill:~$ sudo blkid -o list
device fs_type label mount point UUID
----------------------------------------------------------------------------------------------------------
/dev/sda1 ext4 /media/sda1 888ad3c6-4bc1-4089-b4f4-c32a6a33c0bd
/dev/sda5 ext4 / 7dd68644-0f72-434e-b5fc-8381f0424f91
/dev/sda3 ext4 /media/sda3 e26a7d33-98b8-49f7-8e64-90eb1b7965e0
/dev/sda6 ext4 /media/sda6 f8cfc4d3-8542-4b04-89fc-cef2ef07a821
/dev/sda7 ext4 /media/sda7 62769535-815c-4ff6-a156-840e24f0a40d
/dev/sda8 ext4 /media/sda8 2b1c7764-f2b0-4064-8f7d-1798c208fc74
/dev/sda9 ext4 /media/sda9 98a423e2-4920-414f-acad-c855fdf4c617
And what is the partition where GRUB sits?
Code: Select all
bbq@grill:~$ sudo fdisk -l |grep '*'
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sda1 * 1 638 5124703 83 Linux
And how do I know what partition has what kind of Linux installed? A dirty trick:
Code: Select all
cat /boot/grub/grub.cfg |grep class|cut -c 80
Code: Select all
sudo mkdir /media/sda1
sudo mount /dev/sda1 /media/sda1
Code: Select all
cat /media/sda1/boot/grub/grub.cfg |grep class|cut -c 80
Code: Select all
e2label /dev/sda5 WORK
Do this labeling with all your ext filesystem type (!) drives and partitions -- so everything that is ext2, ext3 or ext4, and you will feel a little bit more comfortable when you enter part 2 of this HOWTO :)