Home Index

1. Linux

2. Partition

Linux / Partition /

Hard Drive Partition

1. Open a terminal window and log in as root: $ sudo su -
2. Find out the name of your storage device. $ fdisk -l Some Output /dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA) /dev/mmcblk0p2 122880 7695134 3786127+ 83 Linux /dev/sda1 38 7839719 3919841 b W95 FAT32
3. Check to see if your disk is already mounted with this command: $ df
4. Unmount your drive if it is mounted using this command: $ umount /dev/sda1
5. Create a new partition by typing this command: $ fdisk /dev/sda1
6. Press "n" to make the new partition, and then press "Enter."
7. Press "p" to create a primary partition, and then press "Enter."
8. Press "1" to create the first partition followed by "Enter."
9. Enter the default for both the first and last cylinders
10. Press "t" to change the file system type followed by "Enter."
11. Type "L" to see a list of known types followed by "Enter."
12. Type "83" for "Linux" followed by "Enter."
13. Press "w" to write the partition to the disk and then press "Enter."

Format the New Partition

14. Format the new partition. $ mkfs.ext4 -j -b 4096 /dev/xvdb $ blockdev --getbsz /dev/xvddb
15. Create a new directory and mount the new drive. $ mkdir /data1 $ mkdir /cassandra $ mount /dev/xvdb /cassandra
16. Edit your fstab file so that the new drive will be mounted at boot. $ vi /etc/fstab
17. Add the following line to the end of fstab: /dev/xvdb /cassandra ext4 defaults 1 2 /dev/sda1 /data1 ext4 defaults 1 2
18. Save the fstab file.
18. Save the fstab file.