Last update at :2024-05-11,Edit by888u
Both centos7 and centos6 should be able to use this method to mount disks. The blogger recently bought a server and found that the data disk that comes with the server is a directory with the name /data, but the Pagoda website is installed to /www by default. Directory, what should I do if I don’t know how to mount it? This article will teach you how to mount /data of the data disk to /www.
1. Check the current disk mounting status:
Command: df -h [root@125-227-249-184 /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 50G 2.3G 45G 5% /tmpfs 7.8G 14M 7.8G 1% /dev/shm /dev/sda1 477M 28M 425M 7% /boot /dev/mapper/VolGroup-lv_home 53G 52M 50G 1% /home /dev/sdb1 917G 14G 857G 2% /data
2. Create a new www directory
Command: mkdir /www
3. Uninstall the original /data directory
Command: umount /data
4. Mount the new directory/www
Command: mount /dev/sdb1 /www
5. Check whether the mounting is successful
[root@125-227-249-184 /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 50G 2.3G 45G 5% /tmpfs 7.8G 14M 7.8G 1% /dev/shm /dev/sda1 477M 28M 425M 7% /boot /dev/mapper/VolGroup-lv_home 53G 52M 50G 1% /home /dev/sdb1 917G 14G 857G 2% /www
6. Set up automatic mounting at startup (if not set, the mounted disk directory will not exist after the next restart), and the partition information must be added to /etc/fstab.
Command: echo '/dev/sdb1 /www ext4 defaults 0 0' >> /etc/fstab
Check whether the addition is successful: cat /etc/fstab
[root@125-227-249-184 /]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Fri Dec 8 07:21:20 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/VolGroup-lv_root/ext4 defaults 1 1 UUID=7ffd29bd-6e23-4350-b344-507b6b2a43be /boot ext4 defaults 1 2 /dev/mapper/VolGroup-lv_home /home ext4 defaults 1 2 /dev/mapper/VolGroup-lv_swap swap swap defaults 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/sdb1 /www ext4 defaults 0 0
Check that /dev/sdb1 /www ext4 defaults 0 0 exists in /etc/fstab, which means that the partition information is added successfully and it will be automatically mounted after restarting.
Recommended site searches: .net space, server space, free vps trial 7-day accelerator, domain name registration price, registration inquiry, Chinese domain name, mainland China station group server, US server defense, Chinese domain name fee, Hong Kong server defense, < /p>
发表评论