LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-21-2015, 10:46 PM   #16
RobInRockCity
Member
 
Registered: Feb 2015
Posts: 141

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by rknichols View Post
The ext4 filesystem has creation time, and it's supported in the kernel. I can use debugfs to stat the inode and see crtime, but I don't know of any other tools that do anything with it.
What filesystem does CentOS 6 use?

Is it ext3? ext4? Something else?

BTW, I found this online - pretty cool!! (Comparison of File Systems)


Rob
 
Old 02-22-2015, 12:24 AM   #17
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,618

Rep: Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577
The default in CentOS 6 is ext4.
 
Old 02-22-2015, 12:47 AM   #18
RobInRockCity
Member
 
Registered: Feb 2015
Posts: 141

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
The default in CentOS 6 is ext4.
So if I ever figure out how to use SSH, what command would I type in Terminal to see the "created_on" timestamp for a particular file in CentOS 6?

Sincerely,


Rob
 
Old 02-22-2015, 10:01 AM   #19
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,618

Rep: Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577
You would use the df command to determine what device held the filesystem, then use debugfs to examine that device:
Code:
]# df /etc/profile
Filesystem           1K-blocks    Used Available Use% Mounted on
/dev/sda1            11963960  5563840  5769336   50% /
# debugfs /dev/sda1
debugfs 1.41.12 (17-May-2010)
debugfs:  stat etc/profile
Inode: 48   Type: regular    Mode:  0644   Flags: 0x80000
Generation: 501040978    Version: 0x00000000:00000001
User:     0   Group:     0   Size: 1796
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x547f60b3:c3fa8554 -- Wed Dec  3 13:12:51 2014
 atime: 0x54e93cdb:1119595c -- Sat Feb 21 20:20:11 2015
 mtime: 0x524be20a:00000000 -- Wed Oct  2 04:06:18 2013
crtime: 0x547f60b3:c3fa8554 -- Wed Dec  3 13:12:51 2014
Size of extra inode fields: 28
Extended attributes stored in inode body: 
  selinux = "system_u:object_r:etc_t:s0\000" (27)
EXTENTS:
(0): 33621
debugfs:  quit
Or:
Code:
# df /var/log/messages
Filesystem           1K-blocks    Used Available Use% Mounted on
/dev/mapper/vg_lab3g-var
                      38166008 5128380  31075852  15% /var
# debugfs /dev/mapper/vg_lab3g-var
debugfs 1.41.12 (17-May-2010)
debugfs:  stat log/messages
Inode: 1048849   Type: regular    Mode:  0644   Flags: 0x80000
Generation: 4151459479    Version: 0x00000000:00000001
User:     0   Group:     0   Size: 28665
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 64
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x54e9ee69:d58c90d8 -- Sun Feb 22 08:57:45 2015
 atime: 0x54e99dfa:4d5c5944 -- Sun Feb 22 03:14:34 2015
 mtime: 0x54e9ee69:d58c90d8 -- Sun Feb 22 08:57:45 2015
crtime: 0x54e99dfa:4d5c5944 -- Sun Feb 22 03:14:34 2015
Size of extra inode fields: 28
Extended attributes stored in inode body: 
  selinux = "system_u:object_r:var_log_t:s0\000" (31)
EXTENTS:
(0): 6853035, (1): 6853042, (2): 6853049, (3): 6853055, (4): 6853065, (5): 8950935, (6): 8949760
debugfs:  quit
You do need root privileges to access the device with debugfs.

Last edited by rknichols; 02-22-2015 at 10:06 AM.
 
1 members found this post helpful.
Old 02-22-2015, 12:15 PM   #20
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Thanks rknichols for the info about debugfs.
 
Old 02-22-2015, 02:03 PM   #21
RobInRockCity
Member
 
Registered: Feb 2015
Posts: 141

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Doug G View Post
Thanks rknichols for the info about debugfs.
Yeah, thanks!


Rob
 
Old 02-22-2015, 04:59 PM   #22
RobInRockCity
Member
 
Registered: Feb 2015
Posts: 141

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
You would use the df command to determine what device held the filesystem, then use debugfs to examine that device:

You do need root privileges to access the device with debugfs.
So there is no way for me to determine the "created_on" timestamp for a file on my VPS which runs CentOS 6 if I do NOT have "root" access?

(I can request "root" access, but am not ready for that power for some time to come!!)

Sincerely,


Rob
 
Old 02-22-2015, 08:47 PM   #23
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
RobinRockCity, you probably won't need to find out the creation date of files very often anyway. I have wished creation dates were available in linux for 10+ years, but the absence of the creation date metadata has never really caused me any major problems at all, just some "minor annoyance" on occasion.
 
Old 02-22-2015, 09:52 PM   #24
RobInRockCity
Member
 
Registered: Feb 2015
Posts: 141

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Doug G View Post
RobinRockCity, you probably won't need to find out the creation date of files very often anyway. I have wished creation dates were available in linux for 10+ years, but the absence of the creation date metadata has never really caused me any major problems at all, just some "minor annoyance" on occasion.
So how do you handle things like individual file copies and directory or system backups?

In Mac and Windows, it it understood that if you copy a file the modified_on date remains the same, and I think the created_on date remains the same too.

I learned how to do this today...
Code:
cp -a ~/public_html/. ~/z_webroot_orig/
...which seemed to behave how I am used to things working.

Guess I got off on the wrong foot with cPanel yesterday!


Rob
 
Old 02-22-2015, 10:37 PM   #25
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,714

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280
I don't see how, unless the copy process can overwrite all the timestamps (shouldn't as it allows for forged files). When a file is copied, you are creating a new file that happens to have the same contents as another file. Thus, you would expect the modification date of the new file to be newer than the original file... as would the creation date.

As for backups, I use tar, and create compressed backup files. All metadata is recorded within the tar file.

Last edited by jpollard; 02-22-2015 at 10:42 PM.
 
Old 02-23-2015, 11:09 AM   #26
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,618

Rep: Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577Reputation: 1577
Quote:
Originally Posted by jpollard View Post
I don't see how, unless the copy process can overwrite all the timestamps (shouldn't as it allows for forged files). When a file is copied, you are creating a new file that happens to have the same contents as another file. Thus, you would expect the modification date of the new file to be newer than the original file... as would the creation date.
The command line copy tools have the ability to preserve the atime and mtime timestamps. For cp, the "-a" option includes "--preserve=all", which preserves the atime and mtime timestamps as well as whatever other attributes (mode, ownership, context, links, xattr) can be preserved. The ctime and crtime timestamps cannot be preserved. rsync has similar options. When you use tar to extract files from an archive, it will preserve the recorded mtime and, with the "-p" (--preserve-permissions) option, as much as possible of the other recorded attributes.

A file's owner (or root) can always overwrite the atime and mtime timestamps. The touch command is a convenient command line tool for that. The underlying system calls are utime() and utimes().
 
Old 02-23-2015, 11:26 AM   #27
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
I use rsync for backups.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
create a file with the date included. Springs Linux - Newbie 10 11-27-2012 03:12 AM
[SOLVED] Script to create new directory with date moyorakkhi Linux - Newbie 3 04-22-2011 04:14 AM
script to create directory with date thetiger2003 Linux - Newbie 3 12-06-2010 05:40 AM
[SOLVED] Use date with touch to create new file with date based name craigjl Linux - Newbie 5 03-12-2010 10:46 AM
I want to create user who has right to change the date manoj.linux Linux - Enterprise 3 08-16-2007 05:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration