Linux mounted Data disks migrate Web site data at the same time

Source: Internet
Author: User
Tags vps
ps:88%, I cleaned out a part of the stuff, so somebody else can use it.
This time suddenly understand, VPS bought after not put the data disk up, all the things are system disk,? Dan Jiu stole the core? Boaster Huai Stomach PS,
Because SSH has not found history, so there is no way to screen, below is an article on the web, the specific partition of the disk and format the mount, and so on. I'm here to talk about the problems I've encountered.
According to the article has been able to format successfully, but there is a problem when the mount, my VPS is dedicated to do the Web server, the tragedy is my www directory under the system disk,? Dan Lu Wei Huan Yi?/div>
This is trouble, I want to directly to the heart of the disk mount to the/www directory (the original Web service file is also under/www), I hit the abacus is my new disk mount up, my/www have space,? Dan? Round school? Crossbones smile Skid reef bared intelligence?? The?/div> of the Dirt
So there is a big problem, my site is not open,? sui?/div>
Hurry Lit
This time suddenly if I put the mount just unloaded off will be good? That's a must.
Umount/www
Uninstall off on OK, the site can be normal access, but my data is actually system disk well, the system disk is full of!!!
Have to find a way to solve the problem AH!! I want to think about ...
The Web site program under the WWW directory copy out, and then modify the directory configured in the Vohost, so that the program is to go on my data disk program, said dry on
Modify the inside of the directory, and then restart Apache can! "Quiff the pan-porch and play?/div>
1. Add disk to view disk status
The code is as follows Copy Code
[ROOT@DB1/]# Fdisk-l
disk/dev/sda:10.7 GB, 10737418240 bytes
255 heads, Sectors/track, 1305 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 151 1305 9277537+ Linux
/dev/sda2 1 1204843+ Linux swap
Partition table entries are in-disk order
disk/dev/sdb:5368 MB, 5368709120 bytes
255 heads, Sectors/track, 652 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
From the results of the query, a /dev/sdb disk
2. use fdisk to partition the/dev/sdb
The code is as follows Copy Code
[ROOT@DB1/]# Fdisk/dev/sdb
Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
P
Partition number (1-4): 1
The cylinder (1-652, default 1):
Using Default value 1
Last cylinder or +size or +sizem or +sizek (1-652, default 652):
Using Default value 652
Command (M for help): W
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
Look at the partition again, come out with a /dev/sdb1 area, this 1 is what we specified earlier, if we specify 2, it becomes sdb2.
The code is as follows Copy Code
[ROOT@DB1/]# Fdisk-l
disk/dev/sda:10.7 GB, 10737418240 bytes
255 heads, Sectors/track, 1305 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 151 1305 9277537+ Linux
/dev/sda2 1 1204843+ Linux swap
Partition table entries are in-disk order
disk/dev/sdb:5368 MB, 5368709120 bytes
255 heads, Sectors/track, 652 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDB1 1 652 5237158+ Linux
[ROOT@DB1/]#
If the/proc/partitions does not see the corresponding partition after it is created, use the Parprobe command to refresh it:
The code is as follows Copy Code
[Root@web1 ~]# Cat/proc/partitions
Major Minor #blocks name
8 0 175825944 SDA
8 1 1020096 sda1
8 2 30716280 Sda2
8 3 8193150 Sda3
[Root@web1 ~]# PARTPROBE/DEV/SDA
[Root@web1 ~]# Cat/proc/partitions
Major Minor #blocks name
8 0 175825944 SDA
8 1 1020096 sda1
8 2 30716280 Sda2
8 3 8193150 Sda3
8 4 135893835 SDA4
[Root@web1 ~]#
3. format /dev/sdb1 partition
The code is as follows Copy Code
[ROOT@DB1/]# mkfs-t EXT3/DEV/SDB1
MKE2FS 1.35 (28-feb-2004)
FileSystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
655360 inodes, 1309289 blocks
65464 blocks (5.00%) reserved for the Super user
The Data block=0
Maximum filesystem blocks=1342177280
Block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing Inode Tables:done
Creating journal (8192 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem'll be automatically checked every mounts or
180 days, whichever comes. Use Tune2fs-c or-i to override.
4. Create the table of contents and hang the/dev/sdb1 to the directory
The code is as follows Copy Code
[ROOT@DB1/]# ls
Backup dev initrd media opt sbin sys usr
Bin etc Lib Misc proc SELinux tftpboot var
Boot home lost+found mnt root SRV tmp
[ROOT@DB1/]# mkdir/u01
[ROOT@DB1/]# ls
Backup dev initrd media opt sbin sys u01
Bin etc Lib misc proc SELinux tftpboot usr
Boot home lost+found mnt root SRV tmp var
[ROOT@DB1/]# mount/dev/sdb1/u01
5. Verify that the mount is successful
The code is as follows Copy Code
[ROOT@DB1 /]# DF  -k
filesystem           1k-blocks       used available use% mounted on
/dev/sda1               9131772   7066884    1601012  82% /
none                     454256          0    454256   0% /dev/shm
/dev/sdb1& nbsp;             5154852      43040   4849956   1% /backup
6. set up automatic Mount
The code is as follows Copy Code
[ROOT@DB1/]# Vi/etc/fstab
# this, edited by Fstab-sync-see ' Mans Fstab-sync ' for details
label=//ext3 Defaults 1 1
None/dev/pts devpts gid=5,mode=620 0 0
NONE/DEV/SHM TMPFS Defaults 0 0
NONE/PROC proc Defaults 0 0
None/sys Sysfs Defaults 0 0
Label=swap-sda2 Swap Defaults 0 0
/dev/sdb1/u01 ext3 defaults 0 0
/dev/hdc/media/cdrom Auto Pamconsole,exec,noauto,m
Anaged 0 0
/dev/fd0/media/floppy Auto Pamconsole,exec,noauto,m
Anaged 0 0

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.