Tag Archives: how to secure our herd disk

How to create encrypt and secure partition in RedHat Linux Server

Hello guys in this tutorial we are going to learn how to create encrypt partition in redhat linux server. today world everybody want that our data become secure. we know we have our computer password. So how can anybody create problem for our system.But in case your hard drive loss or any person by mistake take our system password  and  have you very important data in this. then maybe  you not want anybody access your herd drive data. so there for we will create disk encrypt security layer on our herd disk partition partition enccrypt

Step 1 – first we will create partition below Commands

[root@localhost ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 5345.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
First cylinder (4488-5345, default 4488):
Using default value 4488
Last cylinder or +size or +sizeM or +sizeK (4488-5345, default 5345): +200M
Command (m for help): p
Disk /dev/sda: 43.9 GB, 43965677568 bytes
255 heads, 63 sectors/track, 5345 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3187    25599546   83  Linux
/dev/sda2            3188        4462    10241437+  82  Linux swap / Solaris
/dev/sda4            4463        5345     7092697+   5  Extended
/dev/sda5            4463        4487      200781   83  Linux
/dev/sda6            4488        4512      200781   83  Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

Step 2 now we will encrypt partition /dev/sda6 below Commands

[root@localhost ~]# cryptsetup -y -v luksFormat /dev/sda6

Step 3 here we will create mapping for partition

[root@localhost ~]#cryptsetup luksOpen /dev/sda6 vishnu

Step 4 we can look status through below Commands

[root@localhost ~]cryptsetup status vishnu

Step5 now we will format Partition and mount it

[root@localhost ~]mkfs.ext3 /dev/mapper/vishnu

Step6 then we will mount in any folder here i create data1 folder

[root@localhost ~]mkdir /data1
[root@localhost ~]mount /dev/mapper/vishnu

Step 7 now if we want Secure our data we will unmount partition

[root@localhost ~]umount data1

when we will configure security on our herd disk partition. any body can’t access our data if we want access our data in feature  then we will need to mount our partition. so mounting time system will be asking our partition password. if you have any problem in this process so comments here i will solve your problem

Thank you

by Vishnu Sharma