Cloud Server Linux re-mount the specified directory (non-expandable)

Source: Internet
Author: User

The new Hong Kong cloud server, the system can only be installed on the merchant's console.

The system is separate from the hard drive, and the root directory space is only 10G. Need to reset the relevant directory size, such as:/usr,/var,/home and so on.

The following is a subtotal of your own workaround.

First, the initial partition situation (plus a 300G unpartitioned hard disk):

[[email protected] ~]# df-th file system    type      capacity  used with  available percent mount point/dev/mapper/vg_cloud-lv_root              ext4     8.1G   484M   7.2G   7%/tmpfs        tmpfs     2.0G    91k   2.0G   1%/dev/shm/dev/sda1     ext4     508M    51M   431M  11%/boot
[Email protected] ~]# Fdisk-l | lessdisk/dev/sdb:311.4 GB, 311385128960 bytes255 heads, sectors/track, 37857 cylindersunits = cylinders of 16065 * 51 2 = 8225280 bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesDis K Identifier:0x0473169adevice Boot Start End Blocks Id System

Second, partition the hard disk, format, and mount to the/mnt/disk300g node.

[Email protected] ~]# fdisk/dev/sdb    #分区的时候之分一个区/dev/sdb1[[email protected] ~]# mkfs.ext4/dev/sdb1    #格式化分区, Note Your system's file format (ext2, ext3, EXT4), which you can view with df-th. [[email protected] ~]# mkdir/mnt/disk300g && mount-t ext4/dev/sdb1/mnt/disk300g    # mount to node/mnt/dis300g[[emai L protected] ~]# df-th file system    type      capacity  used with  available percent mount point/dev/mapper/vg_cloud-lv_root              ext4     8.1G   484M   7.2G   7%/tmpfs        tmpfs     2.0G    91k   2.0G   1%/dev/shm/dev/sda1     ext4     508M    51M   431M  11%/boot<span style= "color: #cc0000; Background-color:rgb (255, 255, 255);" >/DEV/SDB1     ext4     307G   3.3G   288G   2%/mnt/disk300g</span>


third, the replication root directory needs to be reset the size of the directory node under/mnt/disk300g, the following are/usr,/var,/home for example.

[[email protected] ~]# cp-av/usr/var/home/mnt/disk300g/[[email protected] ~]# ll/mnt/disk300g/total usage 28drwxr-xr-x.  2 root root  4096 September  homedrwx------.  2 root root 16384 May  16:38 lost+founddrwxr-xr-x root root  4096 September   9 usrdrwxr-xr-x. Root Root
   4096 September   9 var


backup/usr,/var,/home directory, and mount the relevant directory under/mnt/disk300g/to the root directory.

You should then be able to see the contents of/usr,/var, and/home as before the backup.

V. Boot/restart auto mount (equivalent to step four operation).

[[email protected]/]# vim/etc/fstab #编辑/etc/fstab file, add the following content #/etc/fstab# Created by Anaconda on Sun Sep 9 10:33:18 2012## Accessible filesystems, by reference, is maintained under '/dev/disk ' # See mans Pages Fstab (5), Findfs (8), Mount (8 ) and/or Blkid (8) For more INFO#/DEV/MAPPER/VG_CLOUD-LV_ROOT/EXT4 defaults 1 1uuid=c3f1c                    F28-b344-4b5e-9f38-fe0781481aa4/boot ext4 defaults 1 2/dev/mapper/vg_cloud-lv_swap swap                   Swap defaults 0 0tmpfs/dev/shm tmpfs defaults 0 0devpts    /dev/pts devpts gid=5,mode=620 0 0sysfs/sys Sysfs Defaults 0 0proc/proc proc defaults 0 0<span style= "COLOR: #cc 0000; " >/dev/sdb1/mnt/disk300g ext4 RW 0 0/mnt/disk300g/home/home None rw,bind 0 0/mnt/disk300g/usr/usr None Rw,bind 0 0/mn T/disk300g/var/vaR None Rw,bind 0 0</span> 
Save exit.





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.