Sei sulla pagina 1di 14

Disk Management:

MBR originally only supported up to 4 partitions. Later on, extended and logical partitions
were introduced to get around this limitation.

There are 3 types of partitions:

Primary
Extended
o Logical

Primary partitions can be bootable and are limited to four partitions per disk or RAID
volume. If a partitioning scheme requires more than four partitions, an extended partition
containing logical partitions is used. Extended partitions can be thought of as containers for
logical partitions. A hard disk can contain no more than one extended partition. The extended
partition is also counted as a primary partition so if the disk has an extended partition, only
three additional primary partitions are possible (i.e. three primary partitions and one extended
partition). The number of logical partitions residing in an extended partition is unlimited. A
system that dual boots with Windows will require that Windows reside in a primary partition.

The customary numbering scheme is to create primary partitions sda1 through sda3 followed
by an extended partition sda4. The logical partitions on sda4 are numbered sda5, sda6, etc.
fdisk command can display only 60 partitions

in this maximum 3 primary partitions

IDE: Integrated Drive electronics

SCSI : small computer system interface

IDE Disk-1 Partitions : 16

SCSI Disk -1 Partitions : 64

MBR bootloader can only boot from a primary partition.

MBR: < primary | primary | primary | primary >

MBR: < primary | primary | extended [logical, logical, logical] >


Step 1: Below command is for check disks information.

Fdisk -l
Step 2: Once you finalize in which disk you want to make partitions then execute below command
with respect disk name(sda, sdb, sdc) here a , b & c are disk count.

Fdisk /dev/sdb

Step 3: After enter into disk normal (system) commands will work. Only below options will work for
make disk changes.

Command (m for help): m

Command action
a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)


Step 4: after made some partitions in disk , execute below command for update disk changes to
kernel.

# Partprobe /dev/sdb

Step 5: Make file system in one format (ext2, ext3 or ext4)

# mkfs t ext3 /dev/sdb1

Or

# mkfs.ext3 /dev/sdb1

Step 6: select or create New directory for map your partition to local directory (Interpreter) .After
mount the data will save in /dev/sdb1 partition not in this mapped directory(eg: /data1)

# mkdir /data1

Step 7: Temporary Mount the partition to the /data1 directory.

# mount /dev/sdb1 /data1

Permanent Mount the partition to the /data1 directory


Vi /etc/fstab

Go to last line and append content as like below.

/dev/sdb1 /data1 ext3 defaults 00

:wq

Save and come out from the file

Below command is for check whether file system mounted or not?

# df h

#df T

-h : Human readable format

-T : File system type

Or mount

Below command is for mount all partitions which are added in /etc/fstab

# mount -a

LAB:

Command (m for help): p

Disk /dev/sdb: 60.2 GB, 60176990208 bytes

255 heads, 63 sectors/track, 7316 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x745b5a73

Device Boot Start End Blocks Id System


/dev/sdb1 1 7316 58765738+ 5 Extended

/dev/sdb5 1 65 522049+ 83 Linux

/dev/sdb6 66 130 522081 83 Linux

/dev/sdb7 131 195 522081 83 Linux

/dev/sdb8 196 260 522081 83 Linux

/dev/sdb9 261 325 522081 83 Linux

/dev/sdb10 326 390 522081 83 Linux

/dev/sdb11 391 455 522081 83 Linux

/dev/sdb12 456 520 522081 83 Linux

/dev/sdb13 521 585 522081 83 Linux

/dev/sdb14 586 650 522081 83 Linux

/dev/sdb15 651 715 522081 83 Linux

/dev/sdb16 716 780 522081 83 Linux

/dev/sdb17 781 845 522081 83 Linux

/dev/sdb18 846 910 522081 83 Linux

/dev/sdb19 911 975 522081 83 Linux

/dev/sdb20 976 1040 522081 83 Linux

/dev/sdb21 1041 1105 522081 83 Linux

/dev/sdb22 1106 1170 522081 83 Linux

/dev/sdb23 1171 1235 522081 83 Linux

/dev/sdb24 1236 1300 522081 83 Linux

/dev/sdb25 1301 1365 522081 83 Linux

/dev/sdb26 1366 1430 522081 83 Linux

/dev/sdb27 1431 1495 522081 83 Linux

/dev/sdb28 1496 1627 1060258+ 83 Linux

/dev/sdb29 1628 1759 1060258+ 83 Linux

/dev/sdb30 1760 1824 522081 83 Linux


/dev/sdb31 1825 1889 522081 83 Linux

/dev/sdb32 1890 1954 522081 83 Linux

/dev/sdb33 1955 2019 522081 83 Linux

/dev/sdb34 2020 2084 522081 83 Linux

/dev/sdb35 2085 2149 522081 83 Linux

/dev/sdb36 2150 2214 522081 83 Linux

/dev/sdb37 2215 2279 522081 83 Linux

/dev/sdb38 2280 2344 522081 83 Linux

/dev/sdb39 2345 2409 522081 83 Linux

/dev/sdb40 2410 2474 522081 83 Linux

/dev/sdb41 2475 2539 522081 83 Linux

/dev/sdb42 2540 2604 522081 83 Linux

/dev/sdb43 2605 2669 522081 83 Linux

/dev/sdb44 2670 2734 522081 83 Linux

/dev/sdb45 2735 2799 522081 83 Linux

/dev/sdb46 2800 2864 522081 83 Linux

/dev/sdb47 2865 2929 522081 83 Linux

/dev/sdb48 2930 2994 522081 83 Linux

/dev/sdb49 2995 3059 522081 83 Linux

/dev/sdb50 3060 3124 522081 83 Linux

/dev/sdb51 3125 3256 1060258+ 83 Linux

/dev/sdb52 3257 3388 1060258+ 83 Linux

/dev/sdb53 3389 3453 522081 83 Linux

/dev/sdb54 3454 3518 522081 83 Linux

/dev/sdb55 3519 3583 522081 83 Linux

Command (m for help): w


The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@testos-02 ~]# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

switch off the mode (command 'c') and change display units to

sectors (command 'u').

Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

First cylinder (3584-7316, default 3584):

Using default value 3584

Last cylinder, +cylinders or +size{K,M,G} (3584-7316, default 7316): +500M

Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

First cylinder (3649-7316, default 3649):

Using default value 3649

Last cylinder, +cylinders or +size{K,M,G} (3649-7316, default 7316): +1024M


Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

First cylinder (3781-7316, default 3781):

Using default value 3781

Last cylinder, +cylinders or +size{K,M,G} (3781-7316, default 7316): +500M

Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

First cylinder (3846-7316, default 3846):

Using default value 3846

Last cylinder, +cylinders or +size{K,M,G} (3846-7316, default 7316): +500M

Command (m for help): n

Command action

l logical (5 or over)

p primary partition (1-4)

First cylinder (3911-7316, default 3911):

Using default value 3911

Last cylinder, +cylinders or +size{K,M,G} (3911-7316, default 7316): +500M


Command (m for help): n

All logical partitions are in use

Total you can create Primary =1 to 4 partitions

Total Logical partitions = 60

/dev/sdb1 1 7316 58765738+ 5 Extended

/dev/sdb5 1 65 522049+ 83 Linux

/dev/sdb6 66 130 522081 83 Linux

/dev/sdb7 131 195 522081 83 Linux

/dev/sdb8 196 260 522081 83 Linux

/dev/sdb9 261 325 522081 83 Linux

/dev/sdb10 326 390 522081 83 Linux

/dev/sdb11 391 455 522081 83 Linux

/dev/sdb12 456 520 522081 83 Linux

/dev/sdb13 521 585 522081 83 Linux

/dev/sdb14 586 650 522081 83 Linux

/dev/sdb15 651 715 522081 83 Linux

/dev/sdb16 716 780 522081 83 Linux

/dev/sdb17 781 845 522081 83 Linux

/dev/sdb18 846 910 522081 83 Linux

/dev/sdb19 911 975 522081 83 Linux

/dev/sdb20 976 1040 522081 83 Linux

/dev/sdb21 1041 1105 522081 83 Linux

/dev/sdb22 1106 1170 522081 83 Linux

/dev/sdb23 1171 1235 522081 83 Linux

/dev/sdb24 1236 1300 522081 83 Linux


/dev/sdb25 1301 1365 522081 83 Linux

/dev/sdb26 1366 1430 522081 83 Linux

/dev/sdb27 1431 1495 522081 83 Linux

/dev/sdb28 1496 1627 1060258+ 83 Linux

/dev/sdb29 1628 1759 1060258+ 83 Linux

/dev/sdb30 1760 1824 522081 83 Linux

/dev/sdb31 1825 1889 522081 83 Linux

/dev/sdb32 1890 1954 522081 83 Linux

/dev/sdb33 1955 2019 522081 83 Linux

/dev/sdb34 2020 2084 522081 83 Linux

/dev/sdb35 2085 2149 522081 83 Linux

/dev/sdb36 2150 2214 522081 83 Linux

/dev/sdb37 2215 2279 522081 83 Linux

/dev/sdb38 2280 2344 522081 83 Linux

/dev/sdb39 2345 2409 522081 83 Linux

/dev/sdb40 2410 2474 522081 83 Linux

/dev/sdb41 2475 2539 522081 83 Linux

/dev/sdb42 2540 2604 522081 83 Linux

/dev/sdb43 2605 2669 522081 83 Linux

/dev/sdb44 2670 2734 522081 83 Linux

/dev/sdb45 2735 2799 522081 83 Linux

/dev/sdb46 2800 2864 522081 83 Linux

/dev/sdb47 2865 2929 522081 83 Linux

/dev/sdb48 2930 2994 522081 83 Linux

/dev/sdb49 2995 3059 522081 83 Linux

/dev/sdb50 3060 3124 522081 83 Linux

/dev/sdb51 3125 3256 1060258+ 83 Linux


/dev/sdb52 3257 3388 1060258+ 83 Linux

/dev/sdb53 3389 3453 522081 83 Linux

/dev/sdb54 3454 3518 522081 83 Linux

/dev/sdb55 3519 3583 522081 83 Linux

/dev/sdb56 3584 3648 522081 83 Linux

/dev/sdb57 3649 3780 1060258+ 83 Linux

/dev/sdb58 3781 3845 522081 83 Linux

/dev/sdb59 3846 3910 522081 83 Linux

/dev/sdb60 3911 3975 522081 83 Linux

Maximum you can create 1 to 4 primary partitions In this if you want to create more partitions.
You have to select must and should in this 4 even one partition as extended and then you can get
chance to create up to 59 partitions inside that extended partition.

LAB:

Command (m for help): p

Disk /dev/sdc: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x2b956356

Device Boot Start End Blocks Id System

/dev/sdc1 1 132 1060258+ 83 Linux

/dev/sdc2 133 264 1060290 83 Linux


/dev/sdc3 265 329 522112+ 83 Linux

/dev/sdc4 330 394 522112+ 83 Linux

Command (m for help): n

You must delete some partition and add an extended partition first

Command (m for help): d

Partition number (1-4): 4

Command (m for help): p

Disk /dev/sdc: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x2b956356

Device Boot Start End Blocks Id System

/dev/sdc1 1 132 1060258+ 83 Linux

/dev/sdc2 133 264 1060290 83 Linux

/dev/sdc3 265 329 522112+ 83 Linux

Command (m for help): n

Command action

e extended

p primary partition (1-4)


e

Selected partition 4

First cylinder (330-1044, default 330):

How to mount partition with UUID

Find disk UUIDs using below command.

#Blkid

For new partitions:

Step 1:

Fdisk /dev/sdb

And make one partition and then come out.

UUID will not generate until you execute below command.

Mkfs t ext3 /dev/sdb1 or mkfs.ext3 /dev/sdb1

Step 2:

Blkid and take the encrypted id of specific partition.

Vi /etc/fstab

UUID=copy encrypted id mountpoint name ext3 defaults 0 0

Potrebbero piacerti anche