My new disk not showing in command df
Solution 1
I don't see a partition number included.
Instead of
mkdir -p /mnt/vdb
mkfs.ext4 /dev/vdb
mount /dev/vdb /mnt/vdb
Try
mkdir -p /mnt/vdb1
mkfs.ext4 /dev/vdb1
mount /dev/vdb1 /mnt/vdb1
Solution 2
You're mixing up the steps. Either format (mkfs) the whole disk, or partition it (and mkfs the individual partitions). Doing both on the same device is useless.
In other words: Since this is a virtual disk for your VPS only, just the first 3 commands would have been enough. You don't need to use fdisk here.
Otherwise, if you decide to use fdisk anyway, then mkfs+mount must be done on the individual partition devices (vdb1, vdb2...), not on the whole disk.
(This might be the reason why vdb got automatically dismounted: even though you had created an ext4 filesystem on it, fdisk destroyed that.)
Also, your disk is 50 GB, not 80.
Related videos on Youtube
Ping
Updated on September 18, 2022Comments
-
Ping almost 2 years
I'm very new to Linux and I just mount a new 80GB disk into my VPS with only 10GB using command:
mkdir -p /mnt/vdb mkfs.ext4 /dev/vdb mount /dev/vdb /mnt/vdb
After that I try create a partition using:
fdisk /dev/vdb
And then when I type
lsblk
it shows:NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 253:0 0 10G 0 disk └─vda1 253:1 0 10G 0 part / vdb 253:16 0 50G 0 disk └─vdb1 253:17 0 50G 0 part
And
fdisk -l
shows:Disk /dev/vda: 10.7 GB, 10737418240 bytes 4 heads, 32 sectors/track, 163840 cylinders, total 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00096ccc Device Boot Start End Blocks Id System /dev/vda1 * 2048 20971519 10484736 83 Linux Disk /dev/vdb: 53.7 GB, 53687091200 bytes 7 heads, 22 sectors/track, 680893 cylinders, total 104857600 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x9c319ee4 Device Boot Start End Blocks Id System /dev/vdb1 2048 104857599 52427776 83 Linux
But
df -h
did not show my new volume:Filesystem Size Used Avail Use% Mounted on udev 972M 12K 972M 1% /dev tmpfs 196M 384K 196M 1% /run /dev/vda1 9.9G 1.5G 8.0G 16% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 977M 0 977M 0% /run/shm none 100M 0 100M 0% /run/user
I just follow all the tutorial I googled and keep trying, but it seems my total disk space available is still 10GB. Any help please?
-
Ping about 7 yearsThank you very much for your answer, yes after I done the first 3 commands I did saw the new disk appeared in
df -h
, but then when I try to transfer my files from old server to this server using FTP, it failed after transferred 10GB, so I thought it was causing by the disk not correctly mounted. May I know how should undo the fdish? -
Ping about 7 yearsThank you for your answer, I had done the 3 commands and the volume is showing in
df -h
already. May I know is it when the I used up the default 10GB usage and the server will automatically use the 50GB disk? -
SpeedeR_02 about 7 yearsNo, the server will not automatically use the 50GB disk space. You have two main virtual disks named vda and vdb. Each virtual disk having one partition vda1, vdb1. vda1 is mounted under / know as root. vdb1 is mounted under /mnt/vdb1. Any files you put outside /mnt/vdb1 will take up 9.9G as shown in df -h. Any files you put inside /mnt/vdb1 will take up the 50Gb space. You can confirm this by putting two different file sizes one 2GB file in /tmp and 4GB in /mnt/vdb1 and check the output of df -h
-
Ping about 7 yearsI see, thank you for your explanation! Then when I put my files in /mnt/vdb1, is it I have to setup another set of LAMP in this disk in order to let public to access it? Or there is a better way to do this?
-
SpeedeR_02 about 7 yearsNo, you will not have to setup LAMP again on /mnt/vdb1. You need to configure your web server to fetch the website from /mnt/vdb1. If using apache web server you need to edit the httpd.conf file. I'd advise making a copy of these configuration files before editing i.e. httpd.conf.bak. If help is needed on that best research on your web server documentation or submit a new question as it's unrelated to your original question.
-
Ping about 7 yearsAlright thank you so much! I will try to google it!