VPS侦探论坛

 找回密码
 注册
查看: 6462|回复: 3

[提问] 求教,挂载硬盘到/home目录作为数据盘,这样算是成功了么?

[复制链接]
发表于 2014-6-23 23:15:39 | 显示全部楼层 |阅读模式

[root@MyCloudServer ~]# dh -ls
-bash: dh: command not found
[root@MyCloudServer ~]# df -l
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       9743696   1241148   7999588  14% /
/dev/xvda1              101086     36764     59103  39% /boot
tmpfs                   524380         0    524380   0% /dev/shm
[root@MyCloudServer ~]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      9.3G  1.2G  7.7G  14% /
/dev/xvda1             99M   36M   58M  39% /boot
tmpfs                 513M     0  513M   0% /dev/shm
[root@MyCloudServer ~]# sdisk -l
-bash: sdisk: command not found
[root@MyCloudServer ~]# fdisk -l

Disk /dev/xvdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table

Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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
/dev/xvda3            1045        1305     2096482+  8e  Linux LVM
[root@MyCloudServer ~]#
[root@MyCloudServer ~]# fdisk -lh
fdisk: invalid option -- h

Usage: fdisk [-b SSZ] [-u] DISK     Change partition table
       fdisk -l [-b SSZ] [-u] DISK  List partition table(s)
       fdisk -s PARTITION           Give partition size(s) in blocks
       fdisk -v                     Give fdisk version
Here DISK is something like /dev/hdb or /dev/sda
and PARTITION is something like /dev/hda7
-u: give Start and End in sector (instead of cylinder) units
-b 2048: (for certain MO disks) use 2048-byte sectors
[root@MyCloudServer ~]# fdisk -l

Disk /dev/xvdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table

Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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
/dev/xvda3            1045        1305     2096482+  8e  Linux LVM
[root@MyCloudServer ~]# cd /home
[root@MyCloudServer home]# dir
[root@MyCloudServer home]#
[root@MyCloudServer home]# fdisk -l

Disk /dev/xvdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table

Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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
/dev/xvda3            1045        1305     2096482+  8e  Linux LVM
[root@MyCloudServer home]# df -l
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       9743696   1241148   7999588  14% /
/dev/xvda1              101086     36764     59103  39% /boot
tmpfs                   524380         0    524380   0% /dev/shm
[root@MyCloudServer home]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      9.3G  1.2G  7.7G  14% /
/dev/xvda1             99M   36M   58M  39% /boot
tmpfs                 513M     0  513M   0% /dev/shm
[root@MyCloudServer home]# fdisk -l

Disk /dev/xvdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/xvdb doesn't contain a valid partition table

Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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
/dev/xvda3            1045        1305     2096482+  8e  Linux LVM
[root@MyCloudServer home]# fdisk /dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 2610.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@MyCloudServer home]# fdisk -l

Disk /dev/xvdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1        2610    20964793+  83  Linux

Disk /dev/xvda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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
/dev/xvda3            1045        1305     2096482+  8e  Linux LVM
[root@MyCloudServer home]# mkfs.ext3 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2621440 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
160 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 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@MyCloudServer home]# cd ~
[root@MyCloudServer ~]# dir
gzidc
[root@MyCloudServer ~]# dir home
dir: home: No such file or directory
[root@MyCloudServer ~]# cd /home
[root@MyCloudServer home]# dir
[root@MyCloudServer home]# cd ~
[root@MyCloudServer ~]# mount /dev/xvdb1 /home/
[root@MyCloudServer ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      9.3G  1.2G  7.7G  14% /
/dev/xvda1             99M   36M   58M  39% /boot
tmpfs                 513M     0  513M   0% /dev/shm
/dev/xvdb1             20G  173M   19G   1% /home
[root@MyCloudServer ~]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
[root@MyCloudServer ~]# vi /etc/fstab
[root@MyCloudServer ~]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
/dev/xvdb1              /home                   ext3    defaults,noatime 0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
[root@MyCloudServer ~]# passwd
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@MyCloudServer ~]# reboot

Broadcast message from root (pts/7) (Mon Jun 23 23:11:30 2014):

The system is going down for reboot NOW!
[root@MyCloudServer ~]#
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2014-6-24 08:12:46 | 显示全部楼层


过程是没错,不过之前/home下的目录和文件是要在挂载前先拷出来的,挂载后在拷回去
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2014-6-24 11:30:27 | 显示全部楼层

回复 2# 的帖子


我的是重装系统之后挂载的,挂载了之后才安装lnmp0.9,这样需要复制出来么?谢谢军哥!
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2014-6-24 12:52:23 | 显示全部楼层



只要下面没数据就不用复制出来
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-5-19 10:53 , Processed in 0.026485 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表