Sunday, August 21, 2016

CentOS Adding Hard Disks




I currently have a server with 500GB storage (2 physical disks, raid 0) and its already full. I've asked my provider for an upgrade of additional 1TB storage (2 physical, raid 0). These are all hardware based raid.



Almost all files from /usr/local/nginx/html are videos and have consumed the first hard disk raid. Now I wanna know that if I purchased this additional hard disk, would any file saved into the same directory be automatically saved into the newly added hard disk?



Because what Im doing is Im hosting video files on that directory, and I want to continue saving on that particular directory only.


Answer



You'd be better served by backing up your data, and having your host re-provision (meaning re-install the OS) the server with (4) 1TB drives in RAID10 for fault-tolerance and speed. This usually doesn't add much to the bottom-line monthly price of the server but if your host doesn't have an inventory of 1TB drives, picking them up at current market prices of 250%+ of what they were just 6 months ago might be costly.



If that isn't an option and you're well aware of the real potential for data-loss with RAID0 in production, then what I would suggest is carving your new RAID0 into an LVM (the RAID0 unit will be one physical volume, 1 volume group, and 1 logical volume).




pv0 - Use the RAID0 device (md0 if software RAID, or probably sdX if hardware RAID)
vg0 - Use all of the space (the entire 1TB of the RAID device)
lv0 - Do not use all of the space in the volume group. Allocate maybe 500GB of 1TB and format it as an ext3 filesystem. Mount it to a temporary location (/mnt/temp for instance), and move your video file data to it. Then remount the device at the existing location of the video data:



mount /dev/mapper/vg0/lv0 /usr/local/nginx/html



Create the appropriate fstab entry (man fstab). Now having left extra space on vg0 you have the option to use that space elsewhere on the server should another directory fill the 500GB partition, or the ability to add more space to vg0 as needed.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...