Posted: . At: 8:06 AM. This was 1 year ago. Post ID: 17946
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to get the date and time when a partition was last mounted on Linux?


Getting the date and time when a partition was last mounted is very easy. This is done with the tune2fs utility.

[root@localhost john]# tune2fs -l /dev/sdb1 | grep 'Last'
Last mounted on:          /mnt/ubuntu
Last mount time:          Fri Apr 28 06:42:01 2023
Last write time:          Fri Apr 28 06:42:01 2023
Last checked:             Sun Dec 19 17:29:12 2021

This is very simple.

Create a dump of information about your LVM partition configuration using this easy command. This generates a report tarball in your /root directory.

[root@localhost john]# lvmdump 
Creating dump directory: /root/lvmdump-localhost-20230427215722
 
Gathering LVM & device-mapper version info...
Gathering dmsetup info...
Gathering process info...
Gathering console messages...
Gathering /etc/lvm info...
Gathering /dev listing...
Gathering /sys/block listing...
Creating report tarball in /root/lvmdump-localhost-20230427215722.tgz...

Just unpack the tarball.

[root@localhost ~]# tar -xvf lvmdump-localhost-20230427215722.tgz

Then all of the files are available to peruse.

Like this one.

[root@localhost lvmdump-localhost-20230427215722]# cat dmsetup_info 
Name             Maj Min Stat Open Targ Event  UUID                                                                
rl-home          253   2 L--w    1    1      0 LVM-jP0sHNAmgN6HwNJD2ETs3HBxDgofqXd0WM62tPDchAzGO7B7LvYyVkCsn3brBDKD
rl-root          253   0 L--w    1    1      0 LVM-jP0sHNAmgN6HwNJD2ETs3HBxDgofqXd0PcMJxndMYq1Yt6Jf8qVPH2f4LsRCdtjK
rl-swap          253   1 L--w    2    1      0 LVM-jP0sHNAmgN6HwNJD2ETs3HBxDgofqXd01dua01BUemhmlf54y26kWG5kQ0LiuJp6

And this one.

[root@localhost lvmdump-localhost-20230427215722]# cat etc_lvm_listing 
/etc/lvm:
total 132
drwxr-xr-x.   7 root root    115 Feb  6 13:22 .
drwxr-xr-x. 164 root root   8192 Apr 28 06:47 ..
drwx------.   2 root root     35 Feb  6 02:30 archive
drwx------.   2 root root     16 Feb  6 02:30 backup
drwx------.   2 root root      6 Nov  1 19:13 cache
drwxr-xr-x.   2 root root     28 Apr 28 06:42 devices
-rw-r--r--.   1 root root 111694 Nov  1 19:13 lvm.conf
-rw-r--r--.   1 root root   2299 Nov  1 19:13 lvmlocal.conf
drwxr-xr-x.   2 root root   4096 Feb  6 13:22 profile
 
/etc/lvm/archive:
total 4
drwx------. 2 root root   35 Feb  6 02:30 .
drwxr-xr-x. 7 root root  115 Feb  6 13:22 ..
-rw-------. 1 root root 2245 Feb  6 02:30 rl_00000-655187927.vg
 
/etc/lvm/backup:
total 4
drwx------. 2 root root   16 Feb  6 02:30 .
drwxr-xr-x. 7 root root  115 Feb  6 13:22 ..
-rw-------. 1 root root 2244 Feb  6 02:30 rl
 
/etc/lvm/cache:
total 0
drwx------. 2 root root   6 Nov  1 19:13 .
drwxr-xr-x. 7 root root 115 Feb  6 13:22 ..
 
/etc/lvm/devices:
total 4
drwxr-xr-x. 2 root root  28 Apr 28 06:42 .
drwxr-xr-x. 7 root root 115 Feb  6 13:22 ..
-rw-------. 1 root root 228 Apr 28 06:42 system.devices
 
/etc/lvm/profile:
total 36
drwxr-xr-x. 2 root root 4096 Feb  6 13:22 .
drwxr-xr-x. 7 root root  115 Feb  6 13:22 ..
-r--r--r--. 1 root root  531 May 19  2022 cache-mq.profile
-r--r--r--. 1 root root  339 May 19  2022 cache-smq.profile
-r--r--r--. 1 root root 3020 Nov  1 19:13 command_profile_template.profile
-r--r--r--. 1 root root 2309 May 19  2022 lvmdbusd.profile
-r--r--r--. 1 root root  828 Nov  1 19:13 metadata_profile_template.profile
-r--r--r--. 1 root root   76 May 19  2022 thin-generic.profile
-r--r--r--. 1 root root   80 May 19  2022 thin-performance.profile
-r--r--r--. 1 root root  563 May 19  2022 vdo-small.profile

This will provide a lot of very useful information about your LVM configuration on Linux.


Leave a Comment

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