TIPS: Add new partitions for Linux servers

Source: Internet
Author: User
Article Title: tip: Add new partitions for Linux servers. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
This operation is performed remotely. It seems a bit unimaginable on windows. linux is good, and everything can be operated remotely.
  
After I add a new hard disk to the data center, I log on to the machine room through ssh to add a new partition.
  
This time we mainly want to move the previous sdc1, I .e. the/home partition, to the newly added hard disk. In sdc, we checked a lot through the badblocks command and declared failure after several repair attempts, so we decided to replace the faulty hard disk with a new one.
  
The new hard disk is sdb, first partitioning first;
  
Fdisk/dev/sdb
If a partition exists before, use the d command to delete it first.
  
Then, run the n command to add a new partition.
  
I don't want to introduce this. If you want to add a swap partition, remember that the partition code is 82 instead of the default linux Code 83.
  
Remember to save the w command and exit. Be sure to save it.
  
OK. The partition is formatted,
  
Mkfs. ext3-c/dev/sdb1
Note that I use the-c option to check the hard disk in the read-only mode. This command will check the hard disk when formatting the hard disk and mark the wrong hard disk "block ". It takes a lot of patience to format the hard disk using this method, because after the command is run, the hard disk will be checked one by one in Read mode.
  
After the format, I think it is necessary to check whether your new hard disk has bad channels. It may be caused by bad channels.
  
Badblocks-B 4096-c 16/dev/sdb1-o sdb1-badblocks-list
-C number of blocks is the number of checks. The default value is 16. This command requires patience. Here, "badblocks" takes a block of 4096 and each block checks 16 times to output the result to the "sdb1-badblocks-list" file.
  
If the hard disk is normal, the sdb1-badblocks-list should have no content, there is a bad track.
  
Partition, format, and check. The final step is to modify the/etc/fsatb file.
  
It's easy. You just need to change the partition corresponding to the previous home to the current partition. Of course, if there is data transfer, please transfer in advance.
Below are my settings for New Hard Disk Partitions
  
/Dev/sdb1/home ext3 defaults 1 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.