What are the maximum number of usable partitions in a disk in Linux

Linux can generally have two types of Disks. IDE and SCSI.


By convention, IDE drives will be given device names /dev/hda to /dev/hdd. Hard Drive A (/dev/hda) is the first drive and Hard Drive C (/dev/hdc) is the third.

A typical PC has two IDE controllers, each of which can have two drives connected to it. For example, /dev/hda is the first drive (master) on the first IDE controller and /dev/hdd is the second (slave) drive on the second controller (the fourth IDE drive in the computer).

Maximum usable partitions 63 for IDE disks.


SCSI drives follow a similar pattern; They are represented by ‘sd’ instead of ‘hd’. The first partition of the second SCSI drive would therefore be /dev/sdb1.

Maximum usable partitions 15 for SCSI disks.

A partition is labeled to host a certain kind of file system (not to be confused with a volume label). Such a file system could be the linux standard ext2 file system or linux swap space, or even foreign file systems like (Microsoft) NTFS or (Sun) UFS. There is a numerical code associated with each partition type. For example, the code for ext2 is 0x83 and linux swap is 0x82.

To see a list of partition types and their codes, execute /sbin/sfdisk -T

Solved: How to add swap space in Redhat or Ubuntu Linux

In this post  we will see how we can add a file as swap space in Linux. Same steps are to be followed for Redhat and Ubuntu Linux.

Type the following command to create 100MB swap file (1024 * 100MB = 102400 block size):

dd if=/dev/zero of=/swap1 bs=1024 count=102400

Secure swap file

Setup correct file permission for security reasons, enter:

# sudo chown root:root /swap1
# sudo chmod 0600 /swap1

Set up a Linux swap area

Type the following command to set up a Linux swap area in a file:

# sudo mkswap /swap1

Activate /swap1 swap space :

# sudo swapon /swap1

Update /etc/fstab file to make it persistent across reboot.

vi /etc/fstab

Add the following line in file:

/swap1 swap swap defaults 0 0

To check if the swap file is added or not

Type the following swapon command:

#sudo swapon -s
Filename Type Size Used Priority
/dev/dm-0 partition 839676 0 -1
/swap1 file 102396 0 -2

It should show you the new file.

If you want add a logical volume for swap please refer how to add LV for swap .

Solved: Install ifconfig and ssh in Ubuntu

In this post we will see how to install ifconfig and ssh in Ubuntu 16.04 Xenial Xerus. You can install both or either of them independently .


By default you can check IP details in Ubuntu using

ip addr

But if you are more comfortable with “ifconfig”  then follow on.

Ensure that your Ubuntu instance is connected to internet or to your local package repository server from which it can pull packages.

If you need ifconfig in your ubuntu server use following commands.

sudo apt-get update
sudo apt-get install net-tools

“ifconfig” command should now work

ifconfig -a


If you are trying to get ssh. Use the below command.

sudo apt-get install openssh-server

Once the ssh installation is done check the status of ssh service

sudo service ssh status

If the service is not running you will have to start it with following command.

sudo service ssh start

Once this is done you should get a message of service started ok. You can check service status again with

sudo service ssh status

The default configuration file for ssh is /etc/ssh/sshd_config . If you make any changes to this file you will have to restart the ssh service to make the changes effective.

sudo service ssh restart

If you are using docker you can create a golden image after doing this installation. So that you don’t have to do this installation in all new containers. To check how to create a golden image for a docker container check this post .