centos format new drive and mount for backup 1

centos format new drive and mount for backup

fdisk -l
#Find the new drive in list (/dev/sdb) has no partition and that probably means that it’s un-partitioned yet.

#create the partition on /dev/sdb by executing
fdisk /dev/sdb

#and then use following in the prompt
#– “n” for new partion
#– “p” for primary partition
#– “1” for the first partition
#– “Enter” / “Enter” for the first AND last cylinders (automatically use the entire disk)
#– “w” to save what I have done

#Format partition /dev/sdb1
mkfs -t ext3 /dev/sdb1

#create a directory to load the new drive
mkdir /backup

#load /dev/sdb1 as /backup
mount /dev/sdb1 /backup

vi /etc/fstab 
#add at the bottom
/dev/sdb1   /backup   ext3   defaults   0   0

mount -a

#If you got no errors – your mount worked, try df -h once more to see if everything is fine

Here is what the above code is Doing:
1. Create a new partition on /dev/sdb
2. Format the partition as ext3
3. Create a directory to mount the new partition
4. Mount the new partition
5. Add the new partition to /etc/fstab so it will be mounted automatically on reboot
6. Mount all partitions in /etc/fstab

Similar Posts