You are not logged in.
Pages: 1
I recently bought an external hard drive (WD My Passport 5 TB). I wiped the drive with zeroes, created one partition using gdisk with default options for first and last sector, and encrypted that partition with cryptsetup and LUKS. When I view the device in KDE Partition Manager, I see
Partition: /dev/sdc1
Type: ext4 [Encrypted]
Partition Label: Linux LUKS
Size: 4.55 TiB
Used: 37.81 GiB
Is it normal to see that amount of space used on what should be an empty encrypted partition? Is that from the LUKS header? If not normal, what could I have done wrong?
-
If it's helpful, some of the commands I remember using are below:
sudo cryptsetup open --type plain -d /dev/urandom /dev/sdc1 to_be_wipedsudo dd bs=1M if=/dev/zero of=/dev/mapper/to_be_wiped status=progressI thought the dd could be sped up, so I cancelled and restarted with bs=4M, but I saw no improvement. It slowed to a crawl after 24 hours as it approached 5000000000000 bytes, saying it was writing 60MB/s, but the byte count was going much more slowly, so I cancelled.
sudo gdisk /dev/sdcI created a new partition with all defaults: 2048(?) starting sector, default ending sector, and "Linux LUKS" partition type.
sudo cryptsetup luksFormat /dev/sdc1sudo cryptsetup open /dev/sdc1 mypassportsudo mkfs.ext4 /dev/mapper/mypassportIn Dolphin, the only thing on the drive was a "lost+found" folder I couldn't access. I deleted it, but the system still says 37.81 GiB are being used.
Offline
Offline
Never heard of that. That would be 0.83% instead of the default 5%. Is there a way to see how much space is reserved?
I looked at the man pages for mke2fs and tune2fs and only see ways to specify the reserved portion. I'll boot back into my Arch install tonight and try running the commands.
Offline
I tried mke2fs and tune2fs, and from what I can tell, the "-r" option (reserved-blocks-count) lets me set the number of reserved blocks, but not report the number. Thanks for mentioning the reserved space, though.
If you or anyone has any other ideas, I'm all ears. Part of the problem is that I don't know what I don't know.
Offline
What is the output of the following (replace $mountpoint with the path to the mount location of the file-system in question)
# df -h $mountpoint
# du -hs $mountpoint
# tune2fs -l $mountpointOffline
For all commands, I typed "sudo", but replaced it with "#" below. I assume output would be the same:
# df -h /mnt
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/mypassport5tb 4.6T 12K 4.3T 1% /mnt
# du -hs /mnt
4.0K /mnt
# tune2fs -l /mnt
tune2fs 1.46.5 (30-Dec-2021)
tune2fs: Is a directory while trying to open /mnt
Couldn't find valid filesystem superblock.Because of the tune2fs result, I also searched and found this command, in case it helps. The Reserved block count is 5% of the Block count:
# dumpe2fs -h /dev/mapper/mypassport5tb
dumpe2fs 1.46.5 (30-Dec-2021)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: 6bc7b339-a9c1-4227-895d-6496bf22b0e3
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 152616960
Block count: 1220930043
Reserved block count: 61046502
Overhead clusters: 9910600
Free blocks: 1211019440
Free inodes: 152616950
First block: 0
Block size: 4096
Fragment size: 4096
Group descriptor size: 64
Reserved GDT blocks: 1024
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 4096
Inode blocks per group: 256
Flex block group size: 16
Filesystem created: Sat Feb 19 19:15:38 2022
Last mount time: Mon Feb 21 23:05:41 2022
Last write time: Mon Feb 21 23:05:41 2022
Mount count: 4
Maximum mount count: -1
Last checked: Sat Feb 19 19:15:38 2022
Check interval: 0 (<none>)
Lifetime writes: 3312 MB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 32
Desired extra isize: 32
Journal inode: 8
Default directory hash: half_md4
Directory Hash Seed: a5ae3140-de10-4d69-9943-da82961e2c01
Journal backup: inode blocks
Checksum type: crc32c
Checksum: 0xd4fa271b
Journal features: journal_incompat_revoke journal_64bit journal_checksum_v3
Total journal size: 1024M
Total journal blocks: 262144
Max transaction length: 262144
Fast commit length: 0
Journal sequence: 0x00000152
Journal start: 1
Journal checksum type: crc32c
Journal checksum: 0x162587edAnd also:
# dumpe2fs /dev/mapper/mypassport5tb | grep -i superblock
dumpe2fs 1.46.5 (30-Dec-2021)
Primary superblock at 0, Group descriptors at 1-583
Backup superblock at 32768, Group descriptors at 32769-33351
Backup superblock at 98304, Group descriptors at 98305-98887
Backup superblock at 163840, Group descriptors at 163841-164423
Backup superblock at 229376, Group descriptors at 229377-229959
Backup superblock at 294912, Group descriptors at 294913-295495
Backup superblock at 819200, Group descriptors at 819201-819783
Backup superblock at 884736, Group descriptors at 884737-885319
Backup superblock at 1605632, Group descriptors at 1605633-1606215
Backup superblock at 2654208, Group descriptors at 2654209-2654791
Backup superblock at 4096000, Group descriptors at 4096001-4096583
Backup superblock at 7962624, Group descriptors at 7962625-7963207
Backup superblock at 11239424, Group descriptors at 11239425-11240007
Backup superblock at 20480000, Group descriptors at 20480001-20480583
Backup superblock at 23887872, Group descriptors at 23887873-23888455
Backup superblock at 71663616, Group descriptors at 71663617-71664199
Backup superblock at 78675968, Group descriptors at 78675969-78676551
Backup superblock at 102400000, Group descriptors at 102400001-102400583
Backup superblock at 214990848, Group descriptors at 214990849-214991431
Backup superblock at 512000000, Group descriptors at 512000001-512000583
Backup superblock at 550731776, Group descriptors at 550731777-550732359
Backup superblock at 644972544, Group descriptors at 644972545-644973127Offline
I plan to use the drive as-is. Losing(?) 37 GB isn't enough to worry about, and based on the following, I'll consider the drive functional and secure enough for my home use. My real concern was that something else may have remained on the drive despite encrypting.
$ lsblk /dev/sdc
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sdc 8:32 0 4.5T 0 disk
└─sdc1 8:33 0 4.5T 0 part
└─5tb 253:0 0 4.5T 0 crypt /mnt
$ ls -alh /mnt
total 8.0K
drwxr-xr-x 2 root root 4.0K Feb 19 19:26 .
drwxr-xr-x 17 root root 4.0K Feb 25 09:42 ..We didn't solve the mystery, but just let me know if I should mark the thread [SOLVED].
Last edited by uruz (2022-03-02 04:17:18)
Offline
Really strange case. For the next time you want to encrypt a drive, I recommend you to check out shred:
$ sudo shred -n1 -v -z /dev/<drive>It is what I do before using my drives for backups. The default is 3 passes, but I think that it is too much for my use case.
Offline
# df -h /mnt
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/mypassport5tb 4.6T 12K 4.3T 1% /mnt
# du -hs /mnt
4.0K /mnt....
Reserved block count: 61046502
....
Block size: 4096
....61046502 * 4096 = 250046472192 bytes = 250.046 gigabytes which added to the 4.3T = 4.55 which rounded to one decimal places gives 4.6T.
I can not explain where Partition Managers figure comes from.
Last edited by loqs (2022-03-02 23:44:06)
Offline
Pages: 1