LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   shred on ext3 partition - journaled or not? (https://www.linuxquestions.org/questions/linux-software-2/shred-on-ext3-partition-journaled-or-not-701115/)

kap4lin 01-30-2009 04:35 PM

shred on ext3 partition - journaled or not?
 
I've an ext3 partition /dev/sda7 and I want to know with what journaling options this was mounted: (because I want to use shred on it)

fstab entry:
Code:

UUID=......      /media/sda7    ext3    defaults        0      2
mtab entry:
Code:

/dev/sda7 /media/sda7 ext3 rw 0 0
tune2fs -l /dev/sda7 shows (only relevant parts shown)
Code:

Filesystem features:      has_journal ext_attr resize_inode dir_index
filetype needs_recovery sparse_super large_file
Default mount options:    (none)
Journal inode:            8
Default directory hash:  half_md4
Journal backup:          inode blocks

So, is this mounted with data=journal / data=ordered / data=writeback?
More importantly Is there any way to verify what journaling mode is
used on this (or any other) partition? The reason I ask is that shred
(man shred) is not reliable on data=journal mode.

pljvaldez 01-30-2009 05:17 PM

My experience is that shred works fine on partitions with journaling. My understanding is that it doesn't work well on files within journaled partitions.

So I just unmount the partition and then do shred -z -v -n 3 /dev/sda7. I've tried recovery using foremost and photorec at different times and wasn't able to get anything back. Though that's hardly a scientific guarantee... :D

alan_ri 01-30-2009 05:36 PM

Default ext3 journaling mode is ordered,meaning that it only log changes to filesystem metadata but flushes file data updates to disk before making changes to filesystem metadata.If you haven't changed default settings then that's the mode you have.All three modes can be activated and deactivated in /etc/fstab entry for ext3 filesystem.To change it do,for example;
Code:

/dev/hda1    /opt      ext3      data=writeback        1 0
in /etc/fstab entry if you would like to have writeback mode,which I do not recommend because it's a high risk mode.

kap4lin 01-30-2009 05:38 PM

Quote:

Originally Posted by pljvaldez (Post 3426753)
My experience is that shred works fine on partitions with journaling. My understanding is that it doesn't work well on files within journaled partitions.

Actually, I am interested in shredding some files and not the whole partition, sorry for the miscommunication. But it is good to know how it works on the whole partition. So, any way to identify/verify the journaling mode on a partition?

Thanks

kap4lin 01-30-2009 05:48 PM

Quote:

Originally Posted by alan_ri (Post 3426770)
Default ext3 journaling mode is ordered,meaning that it only log changes to filesystem metadata but flushes file data updates to disk before making changes to filesystem metadata.If you haven't changed default settings then that's the mode you have.

Ah, the default is ordered, so shred should work as expected? Still, is there any way to verify it on a mounted partition? I guess what I am looking for is a command something like: "command /dev/sda7" which gives all the mount options used when mounting this partition, explicitly, wherein I can see the journaled mode. Thanks again.

syg00 01-30-2009 08:18 PM

"grep -i data= /proc/mounts"

kap4lin 01-31-2009 01:22 AM

Solved
 
Quote:

Originally Posted by syg00 (Post 3426864)
"grep -i data= /proc/mounts"

Thats exactly what I was looking for. Thanks


All times are GMT -5. The time now is 04:16 PM.