Advertisement
2x100

Untitled

Nov 29th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. To quickly set up a drive up as a single ext4 partition...
  2. View detected devices of class "DISK"
  3. lshw -C disk
  4. View existing partition table(s)
  5. fdisk -l
  6. Edit the partition table for my chosen device (in this case, "sdx")
  7.  
  8. fdisk /dev/sdx
  9. Within FDISK, press:
  10. d ...to delete the current partition
  11. n ...to create a new partition
  12. p ...to specify it as a PRIMARY partition
  13. 1 ...to set it as the 1ST primary partition
  14. w ...to write the changes.
  15. Display the new partition table:
  16. fdisk -lmo
  17. Format the new partition's filesystem as type ext4
  18. mkfs -t ext4 /dev/sdx1
  19. Create a new directory where the new drive will mount into:
  20. mkdir /storage
  21. mount /dev/sdx1 /storage
  22. TUNING
  23.  
  24. Remove reserved blocks (i.e. set to 0%), since this drive is just for user data
  25. tune2fs -m 0 /dev/sdx1
  26. Since server is on UPS, Set write-back so apps don't wait for actual disk writes
  27. tune2fs -o journal_data_writeback /dev/sdx1
  28. Mount at boot up using /etc/fstab and also set write-back policy
  29. vi /etc/fstab
  30. Find (or add) the relevant line in fstab for your drive. Parameters in fstab are separated by white space, for example the drive described above might appear as:
  31. /dev/sdx1 /storage ext4 relatime,errors=remount-ro 0 1
  32. The first parameter identifies the partition (either by /dev/ or a long UUID);
  33. The second parameter is the path the partition will be mounted to;
  34. Third is the filesystem type;
  35. The fourth parameter contains the options;
  36. Fifth is the dump schedule for backups; and,
  37. The sixth parameter is pass-number (used to control fsck order).
  38. Change the options (4th parameter) to:
  39.  
  40. noatime,nodiratime,data=writeback,barrier=0,nobh,errors=remount-ro
  41. Reboot to check that everything went well.
  42. Remember these commands are destructive! Have backups and be careful!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement