LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-27-2013, 06:28 AM   #1
anup1304
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Rep: Reputation: Disabled
Lightbulb Understanding Linux partitions and partitioning commands..


Hello Geeks,

I just have a fair knowledge in Linux or may be not.. But i just started exploring it and I'm loving the stuff.

I'm trying to understand the commands used in Arch installation. Please help me with the following :-


1. The following commands :-

mkdir /mnt
mount /dev/sda1 /mnt
mkdir /mnt/home
mount /dev/sda2 /mnt/home


I understand that "mkdir /mnt" creating the directory "/mnt" and its a temporary location of all the storage. But even "/dev" is the same. Why we are not giving command "mkdir /dev". It might be a stupid question. But I'm just learning this.

And please explain these commands :
mount /dev/sda1 /mnt
mount /dev/sda2 /mnt/home

2. Disk partition

Is it necessary to create a seperate root partition and boot partition ? When we create a boot partition we specify it as a boot partition. How about the root partition, If the /boot partition and the /root partition are not to be the same how we mark a partition as root.


Thank you in advance for your responses.
 
Old 02-27-2013, 06:41 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
/dev is a core part of the install; its not temp/optional. All devices have a /dev entry, not just disks.

The mount cmds mount the disk partitions at the dirs specified.
IOW, dirs are just inodes, but you need physical space to store actual files.
A partition can be mounted at almost any dir, but you'd avoid a lot of them, otherwise it masks the existing dirs.

You don't need separate /boot and '/' (aka root partition) partitions; its optional. However, /boot partitions must be marked as bootable for the BIOS to recognise it.
https://en.wikipedia.org/wiki/Master_boot_record

If you use the cmd
Code:
fdisk -l
(lowercase L there) then you'll see the disk partitions layout. The bootable one is usually marked with *.
You use
Code:
df -hT
to see the dir mount points and filesystem types.
See also the content of the /etc/fstab file.

http://rute.2038bug.com/index.html.gz

HTH & Welcome to LQ
 
Old 02-27-2013, 07:12 AM   #3
anup1304
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Wow !! that was such a quick response.. Thank you soo much.

So If I want seperate /boot and '/', then the /boot partition will be marked with a *, but how will we tell it to use the boot partion as the root partition ?
 
Old 02-27-2013, 07:42 AM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by chrism01 View Post
However, /boot partitions must be marked as bootable for the BIOS to recognise it.
False. The Linux partition that contains or is /boot almost never needs to be marked as bootable. It can even be a logical partition (which cannot even be temporarily flagged as bootable).

Also the BIOS normally does not recognize nor care about the bootable flag on partitions.

The bootable flag matters to Microsoft MBR code and to Windows itself. It does not matter to Linux (Grub) MBR code nor to Linux itself.

In theory, you could put the first part of grub in the partition boot sector (instead of in the MBR) and put Microsoft code in the MBR and flag the Linux partition bootable, so Microsoft MBR code would directly load Grub. By I can't think of why anyone would want such a kludge.

The usual reason to put the first part of grub in the partition boot sector is to let it be chain loaded from Windows or some other Linux boot system. When it is chain loaded, it does not need to be marked bootable.

If you put the first part of grub in the MBR, then there is no reason for any Linux partition to be marked bootable. If you also have a Windows C: partition (and Grub can chain load Windows) then you need the Windows C: partition either permanently or dynamically flagged as bootable (even though it is not the partition that actually boots first).

Quote:
Originally Posted by anup1304 View Post
So If I want seperate /boot and '/', ... how will we tell it to use the boot partion as the root partition ?
I can't understand what relationship you intend for those two phrases: As mutually exclusive alternatives or the second follows from the first. Either way the question doesn't quite make sense.

If you don't make /boot a separate partition, then the Linux installer will automatically make /boot a directory inside /

The first part of Grub needs to be installed somewhere (typically the MBR) and the location of /boot is automatically encoded into that first part of Grub.

Quote:
Originally Posted by anup1304 View Post
If the /boot partition and the /root partition are not to be the same how we mark a partition as root.
Regardless of whether /boot is a separate partition, the config file inside /boot must explicitly tell grub which partition should be /
Even if /boot is a directory inside / the config file in /boot still needs to identify the partition to be used as /
That makes more sense if you remember Grub is a multi-boot system. If you have multiple Linux installs in different partitions, a config file in one /boot directory in one Linux install can give menu choices and associated boot command for all of the Linux partitions.

Last edited by johnsfine; 02-27-2013 at 07:59 AM.
 
1 members found this post helpful.
Old 02-27-2013, 06:49 PM   #5
anup1304
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you for that.

I kind of not getting just one part. What is the significance of creating a logical partition ? I have to create the boot partition as a primary partition, just like in Windows, C drive is a primary partition and the rest of the drives are secondary and logical. But in Windows , the OS itself marks the partition as primary or logical. How does that work in Linux ?
 
Old 02-27-2013, 06:55 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by anup1304 View Post
What is the significance of creating a logical partition ?
The legacy data structure used for partitioning only allows 4 "primary" partitions and if you have any logical partitions then one of the four primary positions is taken for a wrapper around the logical partitions.

Quote:
I have to create the boot partition as a primary partition
Not true. A Linux boot partition can be logical.
 
Old 02-27-2013, 07:03 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Ok looking at my machine, looks like I got carried away there. Some 'boot' partitions are marked, one isn't, but it still works.
Guess I've seen it so often as marked I forgot its not strictly required.

This is a good explanation of partitions http://www.tldp.org/HOWTO/html_single/Partition/
 
1 members found this post helpful.
Old 02-27-2013, 09:18 PM   #8
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 172

Rep: Reputation: 25
A device name like /dev/sda1 is a name that the kernel has chosen to give a certain partition after detecting the presence of that device. Now in order to read/write files & folders on the partition, the file system on that partition must be made available within the overall (root) file system, i.e., it must be mounted, so the file system driver for that partition type (can be anything, also like NTFS) is activated and deals with the partition properly.

To access the contents of that partition, you need a mount point, i.e., a (usually empty) directory somewhere, like e.g. /mnt/my_windows_c/ or /home. Then you run "mount /dev/sda1 /mnt/my_windows_c" (or "mount /dev/sda1 /home") et voila, you can access all the files & folders on the device named /dev/sda1 in the chosen mountpoint (directory).

There are no separate "drive" letters, totally separate from each other. Instead, all partitions are mounted somewhere in a folder in the root partition (tree), which is "/". E.g. the boot partition (if you have decided to use a separate one) is then usually mounted in /boot, and so on.
 
Old 02-27-2013, 09:26 PM   #9
bloody
Member
 
Registered: Feb 2013
Location: Berlin
Distribution: Gentoo, Debian
Posts: 172

Rep: Reputation: 25
About "primary" / "extended" partitions and "logical drives": as for historical reasons, the good-old msdos partition scheme (which is still widely used even on Linux systems, although there are more modern alternatives), can only define up to 4 partitions (primary partitions). That's it. Now as we meanwhile often need more than 4 partitions, an extension was added to the msdos partition scheme that allows to declare the last of all defined partitions (can be any partition from 1 to 4) as a so-called "extended" partition with a simple flag, which is merely a pseudo partition that spans over the rest of the entire harddisk. But then, within the extended partition, further "logical" partitions can be defined inside the extended partition, so the former 4-partition limit could eventually be overcome..
 
Old 02-27-2013, 09:55 PM   #10
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by anup1304 View Post
Wow !! that was such a quick response.. Thank you soo much.

So If I want seperate /boot and '/', then the /boot partition will be marked with a *, but how will we tell it to use the boot partion as the root partition ?

Here's what my Windows and Linux partitions on my machine to give you an idea of what all partitions look like-
Device Boot Start End Blocks Id System
/dev/sda1 1 463 3719016 12 Compaq diagnostics
/dev/sda2 * 464 18273 143052491+ 7 HPFS/NTFS
/dev/sda3 18273 20826 20507649 5 Extended
/dev/sda5 18273 20704 19530752 83 Linux
/dev/sda6 20704 20826 975872 82 Linux swap / Solaris
 
1 members found this post helpful.
Old 02-28-2013, 06:20 AM   #11
anup1304
LQ Newbie
 
Registered: Feb 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you everyone. I have a fair idea on this now though not very much clear. I will do some homework on my end :-)
 
Old 02-28-2013, 06:45 PM   #12
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Your Welcome anup1304

If your problem has been addressed kindly mark your thread "SOLVED"
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Understanding Nmap Commands: In depth Tutorial Part II LXer Syndicated Linux News 0 09-19-2011 11:30 PM
LXer: Understanding Nmap Commands: In depth Tutorial with examples LXer Syndicated Linux News 0 09-17-2011 08:51 PM
partitioning enterprise Linux one or more partitions? jfaubin Red Hat 1 08-23-2007 02:54 PM
Help please for, setting up/understanding Partitions flatstan Linux - Newbie 3 08-13-2006 06:02 AM
linux partitioning (sizes of partitions) r3dhatter Linux - General 14 05-09-2004 03:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration