I'm getting to that right now.
Okay. Good morning.
Let's get started up first off
you celebrate today's Diwali.
For those who celebrate
rating.
I was hoping to do it by this by this class but I, yeah.
There was a little thing a PhD dissertation defense I had to do yesterday, I kind of didn't count my calculations and that took a lot of energy.
So, um, yes.
Yes, thank you for the Wikipedia like.
So, um so yeah so today.
So I'm going to post a tutorial six this afternoon I basically I just need to get it all together.
Oh, what is water Fox, to really say water Fox. Oh, right.
So,
turns out Firefox.
There's this thing with Firefox only allowing official builds to have the Firefox branding.
Easy efficient tutorial five by up by Friday.
That would be a good idea to have it done by Friday yes submissions should be open for yeah I opened up submissions for tutorial five.
Once the schedule it out once the midterms are done because there's no point in me scheduling things okay and so.
Okay, So, it's.
for the final exam will the schedule be out.
Exactly. Allah yes when the final exam. Once we've graded them Oh, I'll be, you know, scheduling those, although I may do is just try contacting people individually.
Because I'm guessing schedules will be a bit more flexible than.
That's, that's a whole other time.
Let's not go there. Um, anyway, let's start with.
Let's go ahead and get started. so files and file systems.
Yes, you're going to hand in tutorial five anytime before assignment assignment three is out. Yes.
So, for files and file systems, What is the.
I remember a.
You have a key, it's a key value store where the key is the powerful key value store because you have a hierarchy, and the and the contents of the
data.
So there's various metadata associated with a file with with it with the key.
Start with each file.
So, this is one thing very important, the metadata is associated with the value.
Not the key.
So.
I know, I think I stands for indirection, I'm not sure.
So, um.
Oh, that's a good point. Um,
well actually, let me show you what's in a. So when we go to, Let's start here.
So here.
So,
so I'm going to create a file.
So I just create a file through here.
And now, I say stop food.
So these.
So, if you want to know what's in it. Basically, you do start.
This is what's in.
And I know.
So, I'm going to just take this year.
Here we go.
So here's that.
a little better. So, what's in here. So there's a lot of fields here some of these are easier to understand than others, things like the UI D the D ID.
That's the user and group of the file it, but it's really member its associated with the value, not the name.
So we have those. If it's a special file we've got a device ID we'll we'll talk about those size, how big it is.
block size we need to little talk about block size in a second year.
And then there's the file type and know and mode. So this is what kind of files, it is that a directory is on the mode is the permission bits.
So, so you'll notice here.
What's it saying here is like it says the file. The here's the file name, which is not in the I node, the size of it, the number of blocks IO blocks regular empty file, you know, so what type is it it's a regular empty file so, but that's not in here.
device. I node number links. So, access. so this big thing here is the permissions you iD iD.
Here are the timestamps there turns out there's actually like this,
simplify things all that.
But it has three timestamps, which are shown here.
Let's go through one of the concepts.
blocks timestamps
timestamps.
Can I know number.
And I know number. So I'm getting two links, that's a whole discussion so I have to know this, but this is
so hard links that's not symbolic links.
Ah, so So let's talk about the timestamps first so good question at the time so,
so,
so, So we'll say access.
modified change.
So,
So if you do tomorrow. that's a status change. Exactly.
Let's Let's test that I have not. Um, let's see now so okay so you got this
what's right.
So.
so I'm kind of surprised I saw the birth thing because you'll notice that I'm
dash if I don't, okay.
Why is it saying creations not normally.
You'll notice here.
birth isn't here.
I'm not sure what birth is coming from because it's not part of what's that normally does.
So, what I'm now curious, let's uh
let's just see what stuff is doing okay about those. So it does all these reads right. Oh,
it's doing.
Why is it doing twice.
Okay.
So it's opening those.
Okay so new Fs at. Okay.
Okay, I'm not sure where that's coming from.
Yeah man page for Scott yeah so that's all there.
Anyway, I have to check with it because like some files many files and like Windows file systems, specify when file keeps track of when files are created.
So here's a funny thing is that whenever you access a file on Unix, it's technically doing a right because it has to update the AI node in order to.
So doing all these doing the right for every read is like, kind of messed up so a lot of times file systems will, we will mount them using a special option, which basically says, be lazy about how you update those, I know timestamps because I don't need
to know exactly what it was accessed. I'd rather know reduce the number of rights.
Know so it updates the entire.
That's a good point.
When the access. Let's see what happened.
Okay good the access did get updated that I read it. And so that got updated here.
So I'm okay, I have to explain.
Okay so, So that's timestamps.
I just do that so there's there's a few things that are update you don't, it doesn't modifying the access timestamp does not modify these, it just as timestamps considered a separate from the rest of the I know.
So, it's a status change. It's not any modification the I know but that's good catch.
What I mean, So
do you are you familiar with the concept of lazy operations in computer science.
So yeah, please like, so so.
so.
So, yeah, like lazy evaluation exactly so means perfectly treadmills.
So here we turn 100 rights to the I know basically for every access we writing to it means that do it lazy and going like, oh, write it a little while, I do it it's like okay, you right there you only doing one right to the I know, instead of 100 times
you save work.
So right the print half versus right you can say.
So,
we're not talking about what this is reads from one file so this is
saying, I know to this 100 times. It's the same I know it's there Ryan that I know basically for every right. Oh, it's been active Oh, it's been access.
Oh, it's been access, you have to technically do it 100 times, if you did eagerly every time the file was read you said oh better right to this right now it's like.
It doesn't have to be that accurate.
You know, we still know roughly when it was accessed. So whether it's so that that's the idea of it so you'll notice this isn't.
I'm
lazy is actually a lot of times a very good optimization strategy.
It's, but it can cause problems, it's, you know, depends on circumstances.
Anyway, so we're talking, so that's lazy.
Now, that's timestamps but there's other there's other big things here so let's talk about the I know numbers.
Well, first let's talk about mobile.
So basically when you.
So, this is basically you stick a USB stick in it has its own file system, it's, I know numbers are completely separate from the I know numbers in your main thing because they are two separate file systems.
Okay, good, good discussion on lazy there.
Yeah.
Oh, so.
So notice so basically if you're if you do this you can always do an ls dash. l ai, and you can see the last word.
I had a defense yesterday.
Up. But if you look here, you see. So you LS dash LA, you just get the normal LS, but if I do this first column shows the I know numbers.
Can I note have to file names.
Yes.
Okay, so if I'm saying, What is sorry.
Yes, directory and file and file contents. So, if I look if I say
I'm sorry I do my present working day, I hope I'm right now in home so my desktop.
And, and then there's, you know, and then of course there's.
So here's food so technically what I'm actually doing.
No.
I wonder how.
So you'll notice that here, home has an AI node of this, so that was the AI note of the home directory.
If I now do the same thing for slash home.
Can I look for Soma.
You'll notice that somehow I've got a few things in my file system here. I do this.
Play do this on the got too much crap my machine.
There.
OK,
so now I'm on the VM.
So, Let's look here so what let's look at.
So we'll just look at the 3000 years of login.ca.
So let's work backwards. So if he doesn't use a login has this I know.
So, the name here is just 3000 user login, but it's in the directory desktop desktop has its own, I know.
You see desktop here has this I node. And then if I did, students there and I.
So, and then there's.
So, any directory.
You'll notice has, has an entry.entry.oh.
Yes.
So, who decides the I know numbers, not either numbers arbitrary numbers, they are typically sequentially assigned for a given file system but they don't have to be some was my username.
That's what I use always on my systems.
So is it was a person I know numbers is it to save time comparing strings will get found by name.
It's more fundamental than that. And that's what I'm trying to show you here at the command line now.
Let's look at the desktop.
Well let's play, let's go and let's just look here.
So here, you so so here we see these things, and then let's,
let's compare these, and let's look at the I know numbers. Do you notice. So do you see this number dot anywhere.
You should see this number somewhere else specifically right here.
Notice that when you're in a directory.
So does the following like any other.
So, no.
Here's the thing, that. Um, Let's see. So notice that
this, there's a three here.
And then there's these ones and twos.
Hardly.
Hardly encountered count is a number of names and I know it happens.
It will exactly there you're getting your you're talking about dot.so.
So you'll notice here, regular files have a link of one.
So that's referring to, you know that this is the one that's the I note, there's only one name for this. And so there's just one link symbolic link.
Same thing.
But note the directories, this directory has a count of two.
Why is that you have account have to because this I note, 393514 has two names.
We're
talking about symbolic links.
Yeah, We're just talking about hard links here.
So notice that user 3000 user login has just a link count of two, because this is one name for it. And if we do
this. Yeah, this is one link for it there.
And then the other link is right. Wait, sorry.
Three, so.
So here in 3000 user login you'll notice that we have 393514 also 39351 fours here we see two entries there's the dot entry here and there's this one here so thus we have a hard link count to.
But you'll notice the parent directory has three.
Exactly, exactly if the folder has a folder with it, the parent folder will have three. Yes, exactly. So, notice the desktop.
Well, we'll talk about desktop in a second here but so the oh so user login. So the desktop one has right now account of three, because there's desktop.
There's dot. And then there's one subdirectory 3000 user login. Now you'll notice that my go dot dot the previous one, it has 17. That's because my main directory, has a whole bunch of directories, it's actually bigger, more than this.
I have a whole bunch of directories here.
And if I count these up I should get to seven, I should get 15 sub directories, 1-234-567-8910 1112 1314 15.
Yeah, there's yeah it's 17 now 15, and then plus two dots and the parents. Thanks.
So.
Oh, how come How come directories need dot, having a link to your cell phone is kind of useless well why an object oriented. Why with objects Do you refer to the object itself sometimes you want to refer it like whenever you notice whenever we say, you
know,
normally normally run a binary Type dot slash 3000 user login.
I'm referring to this directory, that's what it's there. Otherwise, how would I specify the file in this directory, I would have to go, oh I would have to go dot dot slash 3000 user login.
If I didn't have that entry.
Okay, so why is it necessary to use the doc to refer to an executable as an outsider but not for other files normally.
Technically, isn't there is
what let me show you so it turns out when you just talk Yeah exactly, it was not pwd. it's the path.
This is my pass.
Note that.is not in my path.
So, how do I, so basically these are the directories are being searched my current directory is not being searched.
I can change that so right now, if I just type. I'm sorry.
So normally as a doctor.
So my LS is working here, but if I just want to type my ls it will say it's not here. but if I do.
So what I've just now done is I've added dots to the front of my path.
Um, so now if I just type my LS don't have to.
Exactly. So.
so
pseudo dash f.dot.is not a command.
God is not a command. Yes, RM dash.
Technically you can, but it won't let you
so.
So,
Yeah.
So what what understand why dots not in your path.
So let's say I'm an attacker.
And I can, so it's common like there for you to have like a web server.
And so why is it considered secure.
So, so just so Tom, your pwd is your present working directory.
I that's right No, you're right, you're right.
so files we delete something on the youth like so.
They will get delete they work well.
Okay, I'll let Roshi in.
Okay.
Come on, come on, Rosie.
You go Roshi come say hi.
We rushed over here, you don't okay okay we're having a Roshi break.
Hello.
Yes.
You had a good walk
back to where we were.
Okay. Okay, so where where are we
now he's so now this is what he does. When like that so now he's just lying down there.
He's on the ground.
He's a good dog.
The animals have their own personality I can't control when they want to be around.
So, up.
If you want. I'm.
If you want files to actually delete, when you delete them.
So, if you really want, David to be as it turns out, actually, erasing data from disk is fundamentally non trivial.
Especially if we talk about how modern file systems are actually written especially with things like SSD.
It's just turns out there's many copies of things on disk, and I'll explain why later. But if you really need data to be deleted when you explicitly delete it using encrypted file system.
I know ref count equals hard link count Yes, exactly.
Yes, this city.
I agree, I'm.
So is there a system called To delete a file like mem set that can be used an encrypted file system in a non critical know and as you'll understand that's it's just not feasible to erase files on disk properly.
No, it's the shred command.
Okay so,
yes, if you delete the key and encrypted file system the data still exists on the computer, even though the key is lost. Yes. Technically, but the, you have an encrypted data without the key.
And if your encryption is any good.
That's as good as it being raised, because if it.
If it wasn't, then your data wasn't really well encrypted.
So nothing actually gets deleted.
Yes.
Yeah, I've got to talk about.
I've got to get down a couple of levels, before we get to that, but I will cover at least the basics of that.
The first Now let's talk about.
file system is basically an on disk data structure.
So.
yeah. So,
I'm the physical disk is not necessarily in which is why I'm going to get to.
Is there any sort of hard delete this is listening No, there's not a hard delete.
You can't do it. And you'll see why in a little bit.
So anything that promises to do a hard delete of data on an unencrypted file system, don't believe it.
unless it's.
There's some ways you might be able to do it but to be very performance intensive, very slow and even that I would completely trust it.
So, so when I say it's an on this file structure so.
So,
so anyone know.
I'll get to the deleted part in a little bit, just hold off on that up.
What does a disc actually store when we say you have a disk or you know an SSD or whatever, what does it appear to the, to the computer
blocks blocks of bits ones and zeros.
So block so the blocks part. It's.
So note that a disc is really a set of blocks, so.
so big thing was in character devices character devices is one character.
One bite at a time. While blocked devices, it's an entire block out of time, and the number of bytes in a block varies from device to device.
So, if I do a.
How do I. Oh.
So tell me.
So, this is all my home machine like I've got all these devices set up. I'm trying to remember how I can tell the native block size of a device.
It doesn't matter what up what the native blocking block devices so.
So,
first of all, first okay so, so a file system is just a data structure throwing I notes and validating blocks of some fixed size.
So that's the basic way file systems are set up is you have at least in Unix, you have some blocks.
Oh.
So what determine what the size the size of block, so.
So, your file system has its own block size. And then there's the device block size, and so what you want is maybe a one to one mapping of file system block size to the device block size or maybe you have a file system block is twice the size of a disk
block so every time you're just reading two at a time. But you never want it to be a file system block is half the size of the on this block because if it's half the size.
Then, you know, you then start going to ignore access things and have things that just gets inefficient.
So that's it so basically it is decided you could say in the.
So realize that when we talk about firmware for a device when you talk about whether it's a modern hard drive a spinning disk hard drive or an SSD or whatever they're really entire computers they have their own little operating systems in them embedded
in them. And those things are responsible for deciding on the abstraction, the interface that is provided to the main, iOS, so yes it is decided by the by the firmware of how things work inside of it as a black box.
You don't know.
But it's um, you know, but but it's there so um
let's, I'm gonna do a poll here, let's let's do a quick poll here. Um,
let's do.
hard links, I know numbers.
Okay.
I think I went through and deleted a bunch of polls. So I think there are more.
So it's the question of what so the question of why, if you rewrite the entire block a block at once. Do we need character devices. So, you know.
see your keyboard. That's a character device mouse touchpad.
Okay.
So those of you I said something else.
That's a pretty okay 20% of you seem like you're following the rest of you are hard link seeing like the more things blocks, I know. Well, something else, um,
you know, what's the something else if you tell me in the chat and I can maybe address it.
The concepts of hard links I know number of blocks and stuff they're all kind of related and that's really the point of tutorial. Six.
Okay.
Aussies picked a random one. Okay. Okay.
Okay.
So, if you missed the pole. Don't say you missed the pole, ask a question.
Okay.
Thank you.
Anyway, so.
Exactly. That's what the.
So if you're if you're confused at this point with all these concepts, I don't expect them all to kind of gel together and be there that's what the tutorials for, but I'm trying to give you at least some amount of confusion.
Actually,
yes Roshi.
Okay Roshi.
What was it Roshi your head.
Can you all see him what's, what are you doing Roshi UK.
Is it class over yet.
Okay Roshi I'm going to kick you out if you keep doing that.
Do so are USB devices.
Consider character. So, So if you're wondering what kind of device something is.
So if we look at slash Dev.
All your VM.
By the way, I want you to do this yeah so first of all.
Notice he also like we have the blocks a directory. But, so there's so what's your dm zero disk. Well that's a dyslexia, this is a DM zero is a block.
Something blog, these are directories. This is a character by CPU DMA latency okay that's interesting.
kb m character loop. These are all blocked devices
Tiki wise all character devices.
So there's a lot you know the video I think those are, you know, video you know things, those are character devices,
a mirror teach you I teletype that's what how we interface with terminals. The teaching was here for the, you know, General console. But that's.
I talked about that previously.
So basically, I know numbers as unique ways to identify things your false and that's how the oldest ones, I just wanted to say I know it's how the I know is the identifier for the file contents.
So, let me, let me show you something that will should hopefully help.
So I'm going to make a file called.
Go
file.
So now, that's f1. Now, if I do a copy.
f1, to have to.
So here we see f1 f2 have separate I knows, but I can do something.
Now notice.
f1 f2 f3 f one
f one an f3 both refer to the same I know.
Well if to has its own different I note.
So I can so I can do this thing.
So if I can have 123, all the same. I can do now, Echo.
She knows the I knows the same f1.
f3 say, yeah, lm doesn't make the link will well.
What well. Yep, same as f one
f one f three are both the same.
So and but now also look at the hard link numbers. See there's now two links to this, see before. When I first made f1 f2, the links were there was just a one here.
Notice the hard link just a one. And then, now when I do it, there's two issues in that column because now there's two links to the I know to associate with f1 f8 because there's two names for fo you know for that f1 an f3, and I can do this thing of,
I can do an RM of f1.
And now you'll notice f3 is counted has gone down to one f1 is gone, f two is here.
So it's kind of like a pointer me but it's a oh so. So, and cat f2.
So no it's not different every command line.
I didn't delete it.
Why is f3 still there, because I just deleted RM. So, if I do it as trace.
So,
so you see here now we have again a four is the same size and everything same I know now we reach two links Cat Cat four is there.
So now
this.
Yeah.
So we just finished a new part of the new film and points. Yeah, exactly. I'm just it's just a new it's not it's not the pointers refer to memory file names or first I notes, but same basic concept, and the data is to get lost, it's still there, even
though I've changed the name. In order for me to get rid of that I know I have to get rid of all of its names.
And so,
three
years what is RM actually do it. Use the unlinked at with this business checking to make sure the final exists checks to make sure your permissions access, and then it doesn't unlinked at.
With this basically is checking to make sure the final exists checks to make sure you have permissions access, and then it doesn't unlinked out. So I'm link only delete a name possibly the file it refers to.
Because you're deleting the name.
And then, if all the names go away the reference count goes to zero the link count goes to zero, then you can do allocate the I know.
Is there a hard delete remove one I know no there is no way to delete and I know directly. You just have to delete the I nodes.
Yeah, yeah.
Now, I'm going to end with a.
how do I make a file system, a file system is just a data structure.
If know I know it's.
So the.
The I know we will talk about file system structure in a bit because actually it's, you know, the I know it actually, you can't fit all the data in the I notes the I note after first other blocks and stuff so will.
But if we remove all the names of the nodes, then the I node will be going Reference Guide was like, oh that I know it's free and it can be used together.
But I'm going to show you something we can, um, let's make a file.
Okay, good. So you made 100 megabyte thing.
So I just made a big empty file.
Yes.
So when we get EFT for file system.
So, it now has, so it's got a file system they're carrying a file system with Wi Fi 4k blocks and that many I nodes, see know all these concepts I'm talking about.
We'll talk about journaling later.
So I've got a new file system here.
Whitney Iverson.
So now I have new Fs and I have new data.
So notice this directory got called Lost and Found, we'll talk about there. But I can do
my route.
So I've now got three files, ABC, I've created.
I did not create a partition, I just created an empty file.
So you're, you're gonna be doing this the tutorial and you'll learn what's happening but I'm kind of going. I have to go through this I can go step back and explain it so now.
So if you see that the data that we wanted to make, well let's put some.
Okay, so you got test data.
Find it
less, less broke.
I broke last.
Come on. There we go.
What if I could do a smaller file system.
The.
Oh.
Indian skip by three bites.
There we go.
This.
This space is space, some space test.
So, what I'm just what I was just doing right there is awful dump is dumping the raw bytes of the of this file.
I'm saying that in that file is our data that we wanted that test data. And so when we mount. So,
this data, when we are.
Yes, This is all this is.
Okay, we're out of time, but I just wanted to show you.
Yes.
There's a lot of. So there's a lot of questions here are the I know numbers and new data actually independent from the main file system.
Let's check that
they are, they are independent.
And notice this.
Notice know enough.
guys so,
so just so I'm showing you some stuff to just kind of go like, what is going on here.
If you look at the concepts and think about the stuff I've mentioned, you should be able to piece it together by don't expect this all to be like there because this is complicated, now we're getting into how system to actually work.
And what is happening with what the file system is.
So if you just did the same arm of file with a symbolic link you would, would you would lose the data or symbolic links, then just be, so Okay, last thing I'll just say by God, we're over time here.
with that.
Okay. I'm at a time.
Let's.
So again, don't worry if you're feeling confused because we're going to be going over this. But we have to start somewhere.
See you next week.