0

Created 3 partitions for Linux(with dual boot): sda5 sda6 and sda7

$ sudo fdisk -l

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048    718847    716800   350M  7 HPFS/NTFS/exFAT
/dev/sda2          718848 163842047 163123200  77.8G  7 HPFS/NTFS/exFAT
/dev/sda4       163844094 625137344 461293251   220G  5 Extended
/dev/sda5       300913578 574355879 273442302 130.4G 83 Linux
/dev/sda6       574355943 625137344  50781402  24.2G 82 Linux swap / Solaris
/dev/sda7       163844096 300912639 137068544  65.4G 83 Linux


$ lsblk -f
NAME   FSTYPE   LABEL           UUID                                 MOUNTPOINT
sda                                                                  
├─sda1 ntfs     System Reserved C20A88200A881417                     
├─sda2 ntfs                     DEDA9BDBDA9BADF1                     
├─sda4                                                               
├─sda5 ext3                     5420f841-c31f-469e-8ccc-2234a78ac629 
├─sda6 swap                     c8b4b405-868d-44a4-877b-3041eed61974 [SWAP]
└─sda7 ext4                     b3f61b80-d200-40c0-9cfd-f5547ecb8e68 /
sr0                                                                  
loop0  squashfs                                                      /snap/code/7
loop1  squashfs                                                      /snap/core/6964

During partitioning with Ubuntu CD,

mount point to sda7 is given as /

mount point to sda5 is given as /home


But below command does not show /home mount point:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           789M  9.5M  780M   2% /run
/dev/sda7        65G  7.5G   54G  13% /
tmpfs           3.9G  130M  3.8G   4% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop1       89M   89M     0 100% /snap/core/6964
/dev/loop0      127M  127M     0 100% /snap/code/7
tmpfs           789M   56K  789M   1% /run/user/1000

Why df -h does not display /home mount point?

2

It looks like your /dev/sda5 partition is not mounted at all based on the outputs given from df -h.

remember the df command only shows the partitions which have been mounted (excluding swap partitions). If your partition is not mounted it will not show when you type the df command.

As you can see from the command you type, df -h that only sda7 is showing, but sda5 and sda6 are not because one of them is a swap and the other is not even mounted hence it doesnt show when df -h is used.

To mount the dev/sda5 partition you can use the mount command and mount it to the directory of your choice. Example:

mount /dev/sda5 /home/bob

This will mount the sda5 partition into the home directory of the user 'bob'

Once this is done the df command will now show the /home mount point for the /dev/sda5 partition.

FSTAB

For a persistant mount where partitions will be mounted automatically upon boot you need to edit the /etc/fstab file. You need to add it to /etc/fstab use your favourite text editor

Be careful with this file as it can quite easily cause your system not to boot.


#device mountpoint fstype options dump fsck

    /dev/sdb1    /home/yourname/mydata    ext4    defaults    0    1

| improve this answer | |
  • 1) If I run this mount command, does the existing files of /home/username get purged? 2) It should get mount on every start, what entry is needed to add in /etc/fstab for permanent changes? – overexchange Jun 6 '19 at 17:29
  • No not at all, all mounting does is attaches the partition with the file system of the host operating system so it can be accessed and used – Qasim Jun 6 '19 at 17:30
  • But where does it store the mapping entry of /dev/sda5 with mount point /home/username? so that every restart of OS can take care of this mount... because I don't see any entry for this in /etc/fstab – overexchange Jun 6 '19 at 17:33
  • I will edit my answer to add some detail on fstab – Qasim Jun 6 '19 at 17:34
  • But am unable to create a file or directory after mount.... – overexchange Jun 6 '19 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.