Red Hat Enterprise Linux how do I add a new hard disk for backup?

Posted on in Categories , , , , , last updated December 15, 2006

Q. For backup I have added a new hard disk to my remote Linux server. How do I use 250GB SATA hard disk for backup? When I run fdisk -l it shows me one partition. I am using RHEL v4.0

A. You need to use following commands
mke2fs command is used to create an ext2/ext3 filesystem (usually in a disk partition). General syntax is as follows:
mkfs.ext3 /dev/hdX or mkfs.ext3 /dev/sdX : For ext3 file system
mkfs.ext2 /dev/hdX or mkfs.ext3 /dev/sdX : For ext2 file system
mke2fs -j /dev/hdX or mke2fs -j /dev/sdx : Create the filesystem with an ext3 journal.

e2label command will display or change the filesystem label on the ext2/3 filesystem located on device. General syntax is as follows:
e2label /dev/hdX /directory-name
e2label /dev/sdX /directory-name

/etc/fstab – Add your partition here so that it can be automouted after reboot.

For example if your hard disk partition name is /dev/sdb1 type the following commands:
Format a file system
# mke2fs -j /dev/sdb1
Create a mount point
# mkdir /databackup
Make sure only root is allowed to use backup
# chown 0:0 /databackup
# chmod 0700 /databackup

Setup a lable:
# e2label /dev/sdb1 /databackup
Updated /etc/fstab file
# echo "LABEL=/databackup /databackup ext3 defaults 1 2" >>/etc/fstab
Mount newly created file system
# mount -a
# mount /databackup
Verify that everything is working
# df -H
# mount

Next write down backup script to backup data or mysql database. See all our backup related articles for more information.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

1 comment

Leave a Comment