[THE 1st TIME] Disk partitioning pt. 1

Forum rules
Share your brain ;)
machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

[THE 1st TIME] Disk partitioning pt. 1

Unread post by machinebacon » 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:

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
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?

Code: Select all

bbq@grill:~$ sudo fdisk -l |grep '*'
Units = cylinders of 16065 * 512 = 8225280 bytes
/dev/sda1   *           1         638     5124703   83  Linux
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:

Code: Select all

cat /boot/grub/grub.cfg |grep class|cut -c 80
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)

Code: Select all

sudo mkdir /media/sda1
sudo mount /dev/sda1 /media/sda1
and then read the file from there:

Code: Select all

cat /media/sda1/boot/grub/grub.cfg |grep class|cut -c 80
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.

Code: Select all

e2label /dev/sda5 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 :)
..gnutella..

User avatar
ivanovnegro
Minister of Truth
Posts: 5448
Joined: Wed Oct 17, 2012 11:12 pm

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by ivanovnegro » Mon Feb 24, 2014 4:28 am

The labeling is an awesome idea.

User avatar
johnraff
Sperminator
Posts: 199
Joined: Wed Oct 17, 2012 6:38 pm
Location: Japan
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by johnraff » Mon Feb 24, 2014 6:04 pm

bookmarked

Partition labels are very useful. Save you a lot of work sometimes.
All code is one.

User avatar
kiiroitori
dpkg-reconfigure
Posts: 72
Joined: Tue Aug 27, 2013 12:22 pm

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by kiiroitori » Tue Feb 25, 2014 12:59 pm

Very good stuff Sir Bacon, the 1st time can be stressful so this kind of info is gold ! Thank you!

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by catfood » Fri Oct 07, 2016 12:39 am

A few things that helped me sort partitions out too:

Take a screenshot of gparted or lsblk. Edit image and type distro names next to each. I store this on my nfts music partition where I know i wont lose it. Can update as i change this easy.

Also, all my partitions are slightly different sizes to help remember. Debian 33G, others 32,34, or lightweights 8,9,10. Similar sizes based on intended use, but 1GB difference just sticks in your mind easier when you try to remeber in the middle of a new install.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by pidsley » Fri Oct 07, 2016 12:58 am

^ good idea

Or use "e2label" to label the partitions:

Code: Select all

$ sudo e2label /dev/sda1 "jessie"
and then "blkid" to list when you forget:

Code: Select all

$ sudo blkid -s LABEL
/dev/sda1: LABEL="jessie"
/dev/sda5: LABEL="trisquel lxde" 
/dev/sda8: LABEL="shared" 
/dev/sda9: LABEL="LFS" 
/dev/sda12: LABEL="export" 
/dev/sda13: LABEL="anorexia" 
/dev/sda17: LABEL="cardboard" 
/dev/sda18: LABEL="ceramic" 
Or take the lazy way out like me and just write them on a piece of paper (in pencil so you can erase and change as necessary.)

(-:

User avatar
sgtbigman
Oyster-Slurper
Posts: 25
Joined: Sun Jan 24, 2016 2:31 am

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by sgtbigman » Sat Oct 08, 2016 3:57 am

Or take the lazy way out like me and just write them on a piece of paper (in pencil so you can erase and change as necessary.)
I'm now picturing a chalkboard with your partition layout and labels :D

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by wuxmedia » Sat Oct 08, 2016 9:44 am

Had to be (badly) done:
..and what's wrong with Trisquel?
..and what's wrong with Trisquel?
gawd that is bad. touchpad for drawing- not good :(
"Seek, and Ye shall find"
"Github | Chooons | Site"

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by machinebacon » Sat Oct 08, 2016 1:58 pm

^ haha that's excellent!
..gnutella..

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by catfood » Sat Oct 08, 2016 5:03 pm

I used to do paper notes, but now i have a mountain of paper notes crammed in cd binder pocket. Unsure whats even relevant anymore...

A giant partition chalkboard would be the final blow to my sex life. If computer part nintendo dungeon didnt already scare them off, super chalkboard would do it.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by machinebacon » Sat Oct 08, 2016 5:57 pm

^ whiteboard for the win. I got a few whiteboard markers with which I write some notes on the tiles in my kitchen. Super clean thing. No fdisk output there, yet :D
..gnutella..

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by catfood » Sat Oct 08, 2016 9:54 pm

An artistic way to do it...
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by machinebacon » Sun Oct 09, 2016 4:00 am

^ I'm just a cheapo, whiteboards cost moneh :)
..gnutella..

User avatar
darry1966
CLIt Licker
Posts: 398
Joined: Mon Mar 09, 2015 9:13 am
Location: New Zealand

Re: [THE 1st TIME] Disk partitioning pt. 1

Unread post by darry1966 » Sun Oct 09, 2016 8:22 am

Nice work MB appreciate the time and effort you put into your documentation.:)
LinuxBBQ is Sexy. Runs BBQ Stable.

Post Reply