[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: transfering to new HDD



On Thu, Mar 02, 2000 at 01:25:22PM -0600, Oleg Krivosheev wrote:
> On Thu, 2 Mar 2000 kmself@ix.netcom.com wrote:
> 
> > On Thu, Mar 02, 2000 at 10:19:40AM -0500, Allan M. Wind wrote:
> > > On 2000-03-01 23:42:37, kmself@ix.netcom.com wrote:
> > > > On Wed, Mar 01, 2000 at 07:05:04PM -0500, Allan M. Wind wrote:
> > > > > On 2000-03-01 23:42:21, Mary Honeycutt wrote:
> > > 
> > > >     tar cf - source  | ( cd /target; tar xpf - )
> > > 
> > > Yes, that would be more like it.
> > 
> > Thought so.  I'd hate for someone to find out the hard way....
> > 
> > > > There's a utility to recreate the lost+found directory if you do manage
> > > > to overwrite it -- it needs to sit on a specific inode for the filesystem
> > > > to be able to recover lost clusters properly.  RTFM, it's there somewhere.
> > > 
> > > Isn't lost+found created by mkfs?
> > 
> > Yes, it is (or mke2fs, or whatever).  My understanding of this is
> > somewhat limited, but here goes.
> > 
> > Files and directories are identified under most Linux-like fileystems
> > (e2fs, minix fs, UFS, etc., but *not* msdos, vfat), by inodes.  An inode
> > is essentially a database entry in a table giving storage location,
> > name, and values of several attributes (read/write/execute/suid), etc.
>  ^^^^^^
> 
> name? Files are nameless in UNIX. Read about hard links for example
> And from inode you should get storage, attirbutes, times (creation,
> access) and reference counter. 

lost+found inode is 11 for ext2fs.  Do:  

    ls -id /lost+found

As I said, limited understand.  You're right, file name is referenced
only in the directory entry itself, which links an inode to a name.
Renaming myself Luke and using the source shows the structures.

I don't find the lost+found inode definition though.  Anyone?

**********************************
** /usr/include/linux/ext2_fs.h **
**********************************
------------------------------------------------------------------------

[...]

/*
 * Special inodes numbers
 */
#define EXT2_BAD_INO             1      /* Bad blocks inode */
#define EXT2_ROOT_INO            2      /* Root inode */
#define EXT2_ACL_IDX_INO         3      /* ACL inode */
#define EXT2_ACL_DATA_INO        4      /* ACL inode */
#define EXT2_BOOT_LOADER_INO     5      /* Boot loader inode */
#define EXT2_UNDEL_DIR_INO       6      /* Undelete directory inode */

/* First non-reserved inode for old ext2 filesystems */
#define EXT2_GOOD_OLD_FIRST_INO 11

[...]

/*
 * Structure of an inode on the disk
 */
struct ext2_inode {
        __u16   i_mode;         /* File mode */
        __u16   i_uid;          /* Owner Uid */
        __u32   i_size;         /* Size in bytes */
        __u32   i_atime;        /* Access time */
        __u32   i_ctime;        /* Creation time */
        __u32   i_mtime;        /* Modification time */
        __u32   i_dtime;        /* Deletion Time */
        __u16   i_gid;          /* Group Id */
        __u16   i_links_count;  /* Links count */
        __u32   i_blocks;       /* Blocks count */
        __u32   i_flags;        /* File flags */
        union {
                struct {
                        __u32  l_i_reserved1;
                } linux1;
                struct {
                        __u32  h_i_translator;
                } hurd1;
                struct {
                        __u32  m_i_reserved1;
                } masix1;
        } osd1;                         /* OS dependent 1 */
        __u32   i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
        __u32   i_version;      /* File version (for NFS) */
        __u32   i_file_acl;     /* File ACL */
        __u32   i_dir_acl;      /* Directory ACL */
        __u32   i_faddr;        /* Fragment address */
        union {
                struct {
                        __u8    l_i_frag;       /* Fragment number */
                        __u8    l_i_fsize;      /* Fragment size */
                        __u16   i_pad1;
                        __u32   l_i_reserved2[2];
                } linux2;
                struct {
                        __u8    h_i_frag;       /* Fragment number */
                        __u8    h_i_fsize;      /* Fragment size */
                        __u16   h_i_mode_high;
                        __u16   h_i_uid_high;
                        __u16   h_i_gid_high;
                        __u32   h_i_author;
                } hurd2;
                struct {
                        __u8    m_i_frag;       /* Fragment number */
                        __u8    m_i_fsize;      /* Fragment size */
                        __u16   m_pad1;
                        __u32   m_i_reserved2[2];
                } masix2;
        } osd2;                         /* OS dependent 2 */
};

[...]

/*
 * Structure of a directory entry
 */
#define EXT2_NAME_LEN 255

struct ext2_dir_entry {
        __u32   inode;                  /* Inode number */
        __u16   rec_len;                /* Directory entry length */
        __u16   name_len;               /* Name length */
        char    name[EXT2_NAME_LEN];    /* File name */
};

------------------------------------------------------------------------

-- 
Karsten M. Self (kmself@ix.netcom.com)
    What part of "Gestalt" don't you understand?

Scope out Scoop:  http://scoop.kuro5hin.org/
Nothin' rusty about Kuro5hin:  http://www.kuro5hin.org/


Reply to: