Partitioning and Creating and Ext3 or Ext4 filesystem CentOS

We will install a new serial ATA hard drive into our system, and it’s hooked to the second SATA port, thus making our drive “sdb.” Enter the following as root:

# fdisk /dev/sdb

This brings up how many cylinders are on your hard disk, and of course opens up the fdisk program that will allow us to partition our new hard disk.

The next step is to simply enter a “p” to show the partition table. This is useful to see what partitions are already setup on the disk.

Command (m for help): p

Disk /dev/sdb: 50.0 GB, 50019202560 bytes
255 heads, 63 sectors/track, 6081 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System

Command (m for help):

There are no partitions on it. If any partitions are present we’ll just go ahead and delete them by pressing “d.”

Next we’ll need to partition our drive. We’ll keep it simple and mount this drive with a large, single primary partition, just like a backup drive. To do that enter “n” at the command line to create a new partition.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6081, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-6081, default 6081): 6081

Command (m for help):

As you can see, I hit “n” and it asked if I’d like to create a primary (P) or an extended partition (E) I hit P for a primary partition, entered “1″ for it being my first partition on the drive. Your first cylinder will be “1″ and the last one in our case will be “6081.” Most times you will be able to hit enter and use the default cylinder counts.

Verify that we’ve done everything correctly up until this point. At the command prompt enter “p” to check the partition table again:

Command (m for help): p

Disk /dev/sdb: 50.0 GB, 50019202560 bytes
255 heads, 63 sectors/track, 6081 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1      6081  48845601   83  Linux

Command (m for help):

Now you can see that we’ve added a partition to the drive, but we’re not done yet. No changes have been written to the disk yet, everything is just in memory. If everything looks right, go ahead and enter the “w” command which will write the changes to the disk.

Creating an ext3 file system

Now that our disk is partitioned to sdb1 we’ll need to format it. You can format your drive to any filesystem you want, but for our purposes here I’m going to format it with ext3, the most common today. To format your drive:

root@laxmi [~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
7331840 inodes, 29304560 blocks
1465228 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
895 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Using the mk2fs (make file system) command, we specified the type (using the -t) ext3 using the device and partition name (/dev/sdb1). You have successfully partitioned and formatted your new drive. We need to mount this partition to make it usable, and add an entry in the file “/etc/fstab”

We’re going to add this entry in the fstab file because on reboot, our drive that we just mounted will need to be remounted. By adding a simple entry in the fstab file our drive will be mounted every time on startup. To do this we’re going to add the following code on the last line of the file “/etc/fstab”

/dev/sdb1               /backup                  ext3    defaults        1 2

Once you’ve added that to the last line in the file, save it and issue this final command as root:

# mount /dev/sdb1

The mount command mounts the drive for immediate use, and the /dev/sdb1 is our drives partition name.

Creating an ext4 file system

The easiest way to create a file system on a partition is to use the mkfs.ext4 utility which takes as arguments the label and the partition device:

YOU MAY GET THIS IS YOU DO NOT SPECIFY THE NUMBER…

# mkfs.ext4 -L /backup /dev/sdd
mke2fs 1.41.12 (17-May-2010)
/dev/sdd is entire device, not just one partition!

# /sbin/mkfs.ext4 -L /backup /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=/backup
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2097152 inodes, 8388352 blocks
419417 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
256 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mounting a File System

Now that we have created a new file system on the Linux partition of our new disk drive we need to mount it so that it is accessible. In order to do this we need to create a mount point. A mount point is simply a directory or folder into which the file system will be mounted. For the purposes of this example we will create a /backup directory to match our file system label (although it is not necessary that these values match):

# mkdir /backup

The file system may then be manually mounted using the mount command:

# mount /dev/sdb1 /backup

Configuring CentOS 6 to Automatically Mount a Ext4 File System

In order to set up the system so that the new file system is automatically mounted at boot time an entry needs to be added to the /etc/fstab file.

For ext 4 find the UUIS:

# blkid /dev/sdd1
/dev/sdb1: LABEL="/backup" UUID="6043e3e8-f0a3-405b-9905-9a6087fd02fe" TYPE="ext4"

Add to fstab

UUID=6043e3e8-f0a3-405b-9905-9a6087fd02fe /backup     ext4    1       1

The following example shows an fstab file configured to automount our /backup partition:

/dev/mapper/vg_centos6-lv_root /            ext4    defaults        1 1
UUID=0d06ebad-ea73-48ad-a50a-1b3b8ef24491 /boot  ext4    defaults        1 2
/dev/mapper/vg_centos6-lv_swap swap         swap    defaults        0 0
tmpfs                   /dev/shm            tmpfs   defaults        0 0
devpts                  /dev/pts            devpts  gid=5,mode=620  0 0
sysfs                   /sys                sysfs   defaults        0 0
proc                    /proc               proc    defaults        0 0
LABEL=/backup /backup      ext4    defaults        1 2

cPanel comes with a built in handy utility that will automatically detect, format, and partition your new drive with just a few clicks.

To install your new hard drive through cPanel you’ll need to login to WHM as root, and find the button on the left called “Format/Mount a new hard drive” under the drives tab about 3/4 the way down. Click on that. The next page will show you the newly detected drives and have a button next to the drive to select it. Once you select your new drive follow the onscreen instructions, and hit enter.

public_html directory not showing in ftp

A user could not show the public_html directory on a cpanel server. Run the following to see how many files are listed in the directory.

cd /home/username
ls|wc -l
10050

This folder has 10500 files. The settings for ftp do not allow a full directory listing. We removed the files that were not needed and ftp worked.

Also this is a setting in /etc/pure-ftpd.conf

nano /etc/pure-ftpd.conf
# 'ls' recursion limits. The first argument is the maximum number of
# files to be displayed. The second one is the max subdirectories depth

LimitRecursion 10000 8

To change this – change the line amount in the first number and restart ftp

LimitRecursion 11000 8
service pure-ftpd restart

To change the ftp maximum number of files on plesk.

nano /etc/proftpd.conf
ListOptions -a maxfiles 2000 maxdepth 3

Restart xinetd

 service xinetd restart

This configures the -a option by default, and limits the maximum files in the generated listing to 2000. If the client uses the -R option, proftpd will not recurse into directories more than 3 levels deep when generating the listing.

Cannot send or receive mail in WHM/cPanel Exim; frozen in queue

Error:

LOG: MAIN cwd=/usr/local/cpanel/whostmgr/docroot 4 args: /usr/sbin/exim -v -M 1WkPBs-0003X3-Nmdelivering 1WkPBs-0003X3-NmLOG: MAIN PANIC failed to expand condition “${if and{{bool_lax{NULL}}{bool_lax{${perl{should_archive_outgoing_message}}}}}}” for archive_outgoing_email router: Undefined subroutine &main::should_archive_outgoing_message called. inside “and{…}” conditionLOG: MAIN PANIC failed to expand condition “${if and{{bool_lax{NULL}}{bool_lax{${if eq {$authenticated_id}{}{0}{${if eq {$sender_address}{$local_part@$domain}{0}{${if match{$received_protocol}{N^e?smtps?a$N}{${perl{checkbx_autowhitelist}{$authenticated_id}}}{${if eq{$received_protocol}{local}{${perl{checkbx_autowhitelist}{$sender_ident}}}{0}}}}}}}}}}}}” for boxtrapper_autowhitelist router: Undefined subroutine &main::checkbx_autowhitelist called. inside “and{…}” conditionLOG: MAIN PANIC failed to expand condition “${if and{{bool_lax{NULL}}{bool_lax{${perl{check_mail_permissions}}}}}}” for check_mail_permissions router: Undefined subroutine &main::check_mail_permissions called. inside “and{…}” conditionLOG: MAIN PANIC failed to expand condition “${if and{{bool_lax{NULL}}{bool_lax{${perl{enforce_mail_permissions}}}}}}” for enforce_mail_permissions router: Undefined subroutine &main::enforce_mail_permissions called. inside “and{…}” conditionLOG: MAIN PANIC failed to expand condition “${if and{{bool_lax{NULL}}{bool_lax{${perl{increment_max_emails_per_hour_if_needed}}}}}}” for increment_max_emails_per_hour_if_needed router: Undefined subroutine &main::increment_max_emails_per_hour_if_needed called. inside “and{…}” conditionLOG: MAIN == web@cariplex.com R=dkim_lookuphost defer (-1): dkim_lookuphost router failed to expand “${perl{mailtrapheaders}}”: Undefined subroutine &main::mailtrapheaders called.n

Resolution:

You can rebuild the exim configure with


/scripts/buildeximconf

You should also open a ticket using the link in my signature so our techs can determine how your exim.pl.local file became corrupted in order to prevent it from happening again.

Also,
Backup your exim.conf and run the following.


/scripts/eximup --force

Database Upload Error Cpanel PhpMyAdmin

Editing the global php.ini at /usr/local/lib/php.ini does not increase values in the internal PHP for cPanel for PhpMyAdmin.

You have to edit the internal php.ini, which apparently it is reading from /usr/locafile.rather than /usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini file.

nano /usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini
; Maximum size of POST data that PHP will accept.
post_max_size = 50M
upload_max_size = 50M