产品服务AMH 免费服务器主机面板SSL证书 免费SSL证书申请编程助手免费智能写代码、翻译NewAMYSQL 免费MySQL管理工具AMFTP 免费FTP管理客户端

AMH 社区首页

 AMH社区 - 开放自由有价值的社区

[求助帖] 问个问题,如何只把网站数据放到数据盘里?

随风飞翔
铁牌会员
34.00 价值分

随风飞翔 发表于 2015-07-02 02:45:19
有个数据盘,只想把网页文件什么的放在数据盘里,请问该怎么做?数据盘是已经挂载好了的。

谢谢
评价: 这个问题有价值吗?  没有 (0分)   有, 感谢 (0分)
2015-07-02 02:45:19 1

sdujane
铁牌会员
14.00 价值分

同样求解,买的UCloud的云服务器,自动挂载。系统盘快满了,怎么把数据迁移到数据盘呢?
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2018-11-17 00:54:19 2

西藏六哥
铝牌会员
409.39 价值分

引用:
sdujane 发表于 2018-11-17 00:54:19
同样求解,买的UCloud的云服务器,自动挂载。系统盘快满了,怎么把数据迁移到数据盘呢?


备份到本地然后重新装服务器,挂载新硬盘,恢复数据, 这是我的方法,但是应该是可以平移的,只不过我不会,建议提交工单问问A大
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2018-11-17 12:39:05 3

lovem
银牌会员
2685.50 价值分

把数据盘挂载到/home就好了
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2018-11-18 15:37:10 4

sumawan
铁牌会员
13.54 价值分

引用:
lovem 发表于 2018-11-18 15:37:10
把数据盘挂载到/home就好了


具体操作命令 能分享一下么
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2018-11-25 21:05:49 5

向阳
铝牌会员
371.47 价值分

给你写个教程吧
本教程是教你如何挂载硬盘啊

通过 fdisk -l 我们可以看到 /dev/xvdb (此名称因系统而异)容量有多少G,
而且没有分区,接下来我们对它进行分区和挂载

[root@MyVPS ~]# fdisk -l
Disk /dev/xvda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 13 104391 83 Linux
/dev/xvda2 14 1044 8281507+ 8e Linux LVM

Disk /dev/xvdb: 23.6 GB, 23622320128 bytes
255 heads, 63 sectors/track, 2871 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System

对/dev/xvdb(此名称因系统而异)进行分区:

[root@MyVPS ~]# fdisk /dev/xvdb
The number of cylinders for this disk is set to 2871.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

输入n新建分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p

/dev/xvdb中第1个分区
Partition number (1-4): 1
First cylinder (1-2871, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2871, default 2871):
Using default value 2871

输入W保存退出
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

将新分区xvdb1(此名称因系统而异)格式化为ext3格式

[root@MyVPS ~]# mkfs -t ext3 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2883584 inodes, 5765319 blocks
288265 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
176 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, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

我们示范将新分区xvdb1挂载到目录/home
因为home已经存在,所以我们挂载

mount /dev/xvdb1 /home

如果你需要挂载在别的目录.可以新建一个目录挂载.如:home1,使用如下命令:

mkdir /home1
mount /dev/xvdb1 /home1

完成后我们通过 df -hal 可以看到,新分区已经挂载到目录/home上了

[root@MyVPS ~]# df -hal
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 1.4G 4.1G 25% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/xvda1 99M 28M 67M 30% /boot
tmpfs 256M 0 256M 0% /dev/shm
none 0 0 0 - /proc/sys/fs/binfmt_misc
sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs
/dev/xvdb1 22G 173M 21G 1% /home

最后添加开机自动挂载:

echo "/dev/xvdb1 /home ext3 defaults 1 2" >> /etc/fstab

这样就完成了!
通过后台控制系统重做系统之后,只需要重新挂载一次即可

mount /dev/xvdb1 /home

最后,重新添加自动挂载即可:

echo "/dev/xvdb1 /home ext3 defaults 1 2" >> /etc/fstab
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2018-12-01 20:27:27 6

向阳
铝牌会员
371.47 价值分

记得先备份数据,因为涉及到格式化.
你万一格错了,别来骂我啊...

不过现在的阿里云默认就是40G,一般的话,网站数据够你放了哈..

我这是指挂载硬盘,再次说明.
是挂载硬盘教程额.
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2018-12-01 20:29:21 7

向阳
铝牌会员
371.47 价值分

给你找了个挂载的教程:

http://www.vps2ez.com/linux-tutorials/linux-vps-mount-lvm.html
评价: 这个答复有价值吗?  没有 (0分)   有, 感谢 (0分)
回复  2018-12-01 21:38:15 8
 1  (总1页)
AMH社区列表
用户服务中心