Differences
This shows you the differences between two versions of the page.
tech:linux:new_disk [2015/12/05 06:27] |
tech:linux:new_disk [2015/12/05 06:27] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Add New Disk in Linux ====== | ||
+ | ===== Check Disk is installed ===== | ||
+ | <code bash> | ||
+ | fdisk -l|grep Disk | ||
+ | </code> | ||
+ | |||
+ | ===== Partition Disk ===== | ||
+ | Assuming new disk is ''sdc'' | ||
+ | <code bash> | ||
+ | fdisk /dev/sdc | ||
+ | </code> | ||
+ | Commands | ||
+ | <code> | ||
+ | p - to print the partition table | ||
+ | n - to create new | ||
+ | w - to write | ||
+ | </code> | ||
+ | |||
+ | ===== Make file system ===== | ||
+ | Assume you created a single partition on sdc1 | ||
+ | <code bash> | ||
+ | mkfs -t ext4 /dev/sdc1 | ||
+ | </code> | ||
+ | |||
+ | ===== Reserve 1% for root ===== | ||
+ | <code bash> | ||
+ | tune2fs -m 1 /dev/sdc1 | ||
+ | </code> | ||
+ | |||
+ | ===== Create file system ===== | ||
+ | Create Mount directory | ||
+ | <code bash> | ||
+ | mkdir /home1 | ||
+ | </code> | ||
+ | |||
+ | ===== Get Disk UUID ===== | ||
+ | <code bash> | ||
+ | blkid|grep /dev/sdc1 | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== Make entry in fstab to automount ===== | ||
+ | <code> | ||
+ | Add line to /etc/fstab: | ||
+ | # New 2 TB Hard Disk | ||
+ | UUID=d1bff2fd-537b-40fb-8981-cb59bd8e1221 /home1 ext4 defaults 0 2 | ||
+ | </code> | ||
+ | |||
+ | Mount with | ||
+ | <code bash> | ||
+ | mount -a | ||
+ | </code> | ||
+ | |||
+ | Check with | ||
+ | <code bash> | ||
+ | df -Ph | ||
+ | </code> | ||
+ | |||
+ | Test with | ||
+ | <code bash> | ||
+ | dd if=/dev/urandom of=/home1/sample.txt bs=1G count=1 | ||
+ | </code> | ||
+ | |||