Mount the second hard disk on a linux server

Source: Internet
Author: User
The server hard disk reported by the virus and website log analysis yesterday experienced a bad track, causing the system to fail to start. Data in the hard disk needs to be exported, so a temporary machine is found to plug the hard disk to check whether it can be identified. By the way, I am familiar with the fdisk and mount commands. I. check whether the hard disk can be identified # fdisk-lDisk/dev/sda: 36.7 GB, 36703934464bytes255heads, 63 s bad sectors on the server hard disk reported by the virus and website log analysis yesterday, the system cannot be started. Data in the hard disk needs to be exported, so a temporary machine is found to plug the hard disk to check whether it can be identified. By the way, I am familiar with the fdisk and mount commands.

1. check whether the hard disk can be identified
# Fdisk-l
Disk/dev/sda: 36.7 GB, 36703934464 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sda1*1 261 2096451 83 Linux
/Dev/sda2 262 783 4192965 83 Linux
/Dev/sda3 784 1305 4192965 83 Linux
/Dev/sda4 1306 4462 25358602 + 5 Extended
/Dev/sda5 1306 1827 4192933 + 83 Linux
/Dev/sda6 1828 2088 2096451 82 Linux swap
/Dev/sda7 2089 4462 19069123 + 83 Linux
Disk/dev/sdb: 36.7 GB, 36748945408 bytes
255 heads, 63 sectors/track, 4467 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device Boot Start End Blocks Id System
/Dev/sdb1*1 509 4088511 83 Linux
/Dev/sdb2 510 2430 15430432 + 83 Linux
/Dev/sdb3 2431 2557 1020127 + 82 Linux swap
/Dev/sdb4 2558 4467 15342075 f W95 Ext 'd (LBA)
/Dev/sdb5 2558 2811 2040223 + 83 Linux
/Dev/sdb6 2812 3830 8185086 83 Linux
/Dev/sdb7 3831 4467 5116671 83 Linux
/Dev/sdb indicates that the second hard disk has been identified

II. attach a hard disk
1. create a directory on the local hard disk.
# Mkdir/opt/data/tmp1
2. Mount a partition/dev/sdb1 to tmp1 in the second hard disk.
# Mount/dev/sdb1/opt/data/tmp1
3. check whether the disk is mounted.
# Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda1 2.0G 141 M 1.8G 8%/
None 1014 M 0 1014 M 0%/dev/shm
/Dev/sda2 4.0G 1.8G 2.0G 47%/opt
/Dev/sda7 18G 168 M 17G 1%/opt/data
/Dev/sda5 4.0G 1.4G 2.4G 37%/usr
/Dev/sda3 4.0G 2.1G 1.8G 55%/var
/Dev/sdb1 3.9G 1.4G 2.3G 38%/opt/tmp/tmp1

3. detach a hard disk
# Umount/dev/sdb1

Note: 1. the preceding operations must be root users.
2. after the hard disk is inserted, the server needs to be restarted.

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.