Solve add partition in etc/fstab in Debian not being mounted


I use Hpcloud with Debian Image on Small instance. As usual, I load additional/extra hardisk into another folder in filesytem (/var for instance). But somehow it’s doesn’t works at all. Here are the steps and solutions:

1. Check partition
You can check all partition device by :

1
fdisk -l

For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Disk /dev/vda: 10.7 GB, 10737418240 bytes
16 heads, 63 sectors/track, 20805 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/vda doesn’t contain a valid partition table

Disk /dev/vdb: 21.5 GB, 21474836480 bytes
16 heads, 63 sectors/track, 41610 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/vdb doesn’t contain a valid partition table

Disk /dev/vdc: 53.7 GB, 53687091200 bytes
16 heads, 63 sectors/track, 104025 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/vdc doesn’t contain a valid partition table


2. Format and load partition
You should make sure that other partition already formated. We can format partition with “mkfs”.
After format, we can mount it automatically using “/etc/fstab”

1
vim /etc/fstab

Example:

1
2
3
4
5
6
7
8
9
10
11
12
# /etc/fstab: static file system information.
#
# Use ‘blkid’ to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/vda1 during installation
LABEL=hpcs-rootfs /             ext4    errors=remount-ro 0       1
/dev/vdb        /var            ext4    defaults        0       1
/dev/vdc        /var/yodi       ext4    defaults        0       1

3. Update and reboot
This is the most important things. You should update your initramfs by :

1
update-initramfs -k all -u

Then you can reboot and see your partition being mounted automatically.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.