1

I have encrypted my home partition via cryptsetup. Inside the mapper /dev/mapper, i have created a ext4 fs via

mkfs.ext4 /dev/mapper/home

Now, my home partiotion only has 91 GB. My luks partition has ~ 270 GB. Is this normal? How can i resize my ext4 home partition?

Some fdisc -l data:

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 195314547 195312500  93,1G 83 Linux
/dev/sda2       781252606 928055295 146802690    70G  5 Extended
/dev/sda3       195315712 781250559 585934848 279,4G 83 Linux
/dev/sda5       781252608 894498815 113246208    54G 83 Linux
/dev/sda6       894500864 928055295  33554432    16G 82 Linux swap / Solaris

/dev/sda3 is the luks encrypted partition.

Disk /dev/mapper/home: 279,4 GiB, 299981864960 bytes, 585902080 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

So in fdisk /dev/mapper/home and /dev/sda3 have the same size.

Some df -h /home data:

Filesystem       Size    Used  Free  Used %  mounted
/dev/sda1        92G     47G   41G   54%     /

So here we only have 92 GB.

Some parted /dev/mapper/home data:

GNU Parted 3.2
Using /dev/mapper/home
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Linux device-mapper (crypt) (dm)
Disk /dev/mapper/home: 300GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0,00B  300GB  300GB  ext4

Here its seems to have the 300 GB size?

4
  • Your df shows /dev/sda1, not /dev/sda3 or by extension /dev/mapper/home. In other words, you didn't mount it, at least not in /home... Aug 7 '19 at 15:09
  • @frostschutz So you mean, something else could be mounted as /home?
    – MSauer
    Aug 7 '19 at 15:27
  • Well, /dev/sda1 is / and with nothing else mounted in /home, /home also is part of /dev/sda1, just like df /home is trying to tell you. Aug 7 '19 at 15:46
  • @frostschutz Ok. That makes sense. Looks like something in my mounting of the /home position is wrong. I can write things to /home, but only have the size of /. So it looks like I am mounting /dev/sda1 instead of /dev/mapper/home. May be the fstab the correct to look for a problem?
    – MSauer
    Aug 7 '19 at 16:07
0

To make an encrypted partition mount automatically, you'll first need /etc/crypttab set up properly. In your case, that means a line like this:

home /dev/sda3 none luks

(Here I'm assuming you used LUKS; if you used some other mode of cryptsetup, the two last parameters on the line may need to be different.)

This should cause the system to prompt for encryption passphrase at boot time to unlock the encrypted volume and create the /dev/mapper/home device to access it through the encryption layer. Before proceeding further, boot once to verify that this actually works.

Then you'll need a line in /etc/fstab to mount it:

/dev/mapper/home /home ext4 defaults 0 2

Both in /etc/crypttab and in /etc/fstab you'll have the option of using the UUID= syntax instead of the corresponding device name. Please note that the UUID of the /home filesystem (as viewed through /dev/mapper/home for mounting) is extremely unlikely to be the same as the UUID of the encrypted container /dev/sda3.

1
  • Will mark this as the answer. I had written a wrong fstab entry.
    – MSauer
    Aug 7 '19 at 17:29

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.