Free space in unmounted partition
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
Can I find free space of unmounted partition using system files like sys
or proc
?
I know how to find total space but have no idea about free space. Please suggest using system files only. For total space of unmounted partition I am using /proc/partitions
file.
linux disk-usage
add a comment |Â
up vote
3
down vote
favorite
Can I find free space of unmounted partition using system files like sys
or proc
?
I know how to find total space but have no idea about free space. Please suggest using system files only. For total space of unmounted partition I am using /proc/partitions
file.
linux disk-usage
bro it gives total space of the partition.
â Sarthak_Bhutani
Oct 6 '17 at 4:55
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Can I find free space of unmounted partition using system files like sys
or proc
?
I know how to find total space but have no idea about free space. Please suggest using system files only. For total space of unmounted partition I am using /proc/partitions
file.
linux disk-usage
Can I find free space of unmounted partition using system files like sys
or proc
?
I know how to find total space but have no idea about free space. Please suggest using system files only. For total space of unmounted partition I am using /proc/partitions
file.
linux disk-usage
linux disk-usage
edited Oct 3 '17 at 9:23
Vlastimil
6,4761148121
6,4761148121
asked Oct 3 '17 at 3:23
Sarthak_Bhutani
784
784
bro it gives total space of the partition.
â Sarthak_Bhutani
Oct 6 '17 at 4:55
add a comment |Â
bro it gives total space of the partition.
â Sarthak_Bhutani
Oct 6 '17 at 4:55
bro it gives total space of the partition.
â Sarthak_Bhutani
Oct 6 '17 at 4:55
bro it gives total space of the partition.
â Sarthak_Bhutani
Oct 6 '17 at 4:55
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
4
down vote
This is dependent on the filesystem type, but you could try to use fsck
to find out how much free space there is left. Finding the free space requires a tool that understands the structure of the filesystem, and there usually aren't many of those in addition to fsck.
add a comment |Â
up vote
1
down vote
procfs should be used specifically for process related info. (as it is not stictly followed but still to be on safer side don't depend on it as there is chance of it getting deprecated).
so sysfs will give us system info.
this will give info of full disk size.
cat /sys/block/sda/size
replace sda with your partition name.
ls /sys/block/sda/
will give info about partitions available check for directory naming sda1, sda2 ...
same thing as sda can be used to check size of these partitions.
cat /sys/block/sda/sda1/size
Same note as above watch partition names. change sda to sdb,sdc, etc according to your requirement.
Hope this answers your question.
without mounting the partition I doubt we will be able to read free blocks. there is draw back doing so because this info will be written multiple time to update which may be harmful for disk life. so after disk is mounted and scanned this info is available to you.
â Devidas
Oct 3 '17 at 6:29
It shows the number of all blocks on the partition, not the free ones.
â peterh
Oct 4 '17 at 2:27
Yeah you are right peterh. So I have added comment above stating "without mounting the partition I doubt we will be able to read free blocks". I meant in sysfs or procfs. there are other utilities as stated, but he asked for procfs or sysfs so I mentioned it. what I meant while answering was there is a place where info about all partition is stored in kernel but free scpace is not one of them.
â Devidas
Oct 4 '17 at 6:56
add a comment |Â
up vote
0
down vote
There is no general way for that, but there is a way which works in most cases.
The reason, why there is no general way for that, that also the kernel doesn't know it. To know it, first it would need to analyze the partition.
Without mounting the partition, the kernel knows only its existence, but no more. Essentially, it is a line of blocks with random data. The kernel knows, where is it and how to access, but doesn't know, what to do with it.
However, there are also user-space tools which can analyze the content of a filesystem, without mounting them. As all the filesystems have very different data structures, to handle them you need different tools.
In the case of ext2/3/4, it is
# dumpe2fs /dev/your_root|grep '^Free blocks'
dumpe2fs 1.42.13 (17-May-2015)
Free blocks: 5721580
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
This is dependent on the filesystem type, but you could try to use fsck
to find out how much free space there is left. Finding the free space requires a tool that understands the structure of the filesystem, and there usually aren't many of those in addition to fsck.
add a comment |Â
up vote
4
down vote
This is dependent on the filesystem type, but you could try to use fsck
to find out how much free space there is left. Finding the free space requires a tool that understands the structure of the filesystem, and there usually aren't many of those in addition to fsck.
add a comment |Â
up vote
4
down vote
up vote
4
down vote
This is dependent on the filesystem type, but you could try to use fsck
to find out how much free space there is left. Finding the free space requires a tool that understands the structure of the filesystem, and there usually aren't many of those in addition to fsck.
This is dependent on the filesystem type, but you could try to use fsck
to find out how much free space there is left. Finding the free space requires a tool that understands the structure of the filesystem, and there usually aren't many of those in addition to fsck.
answered Oct 3 '17 at 9:09
Johan Myréen
6,94711423
6,94711423
add a comment |Â
add a comment |Â
up vote
1
down vote
procfs should be used specifically for process related info. (as it is not stictly followed but still to be on safer side don't depend on it as there is chance of it getting deprecated).
so sysfs will give us system info.
this will give info of full disk size.
cat /sys/block/sda/size
replace sda with your partition name.
ls /sys/block/sda/
will give info about partitions available check for directory naming sda1, sda2 ...
same thing as sda can be used to check size of these partitions.
cat /sys/block/sda/sda1/size
Same note as above watch partition names. change sda to sdb,sdc, etc according to your requirement.
Hope this answers your question.
without mounting the partition I doubt we will be able to read free blocks. there is draw back doing so because this info will be written multiple time to update which may be harmful for disk life. so after disk is mounted and scanned this info is available to you.
â Devidas
Oct 3 '17 at 6:29
It shows the number of all blocks on the partition, not the free ones.
â peterh
Oct 4 '17 at 2:27
Yeah you are right peterh. So I have added comment above stating "without mounting the partition I doubt we will be able to read free blocks". I meant in sysfs or procfs. there are other utilities as stated, but he asked for procfs or sysfs so I mentioned it. what I meant while answering was there is a place where info about all partition is stored in kernel but free scpace is not one of them.
â Devidas
Oct 4 '17 at 6:56
add a comment |Â
up vote
1
down vote
procfs should be used specifically for process related info. (as it is not stictly followed but still to be on safer side don't depend on it as there is chance of it getting deprecated).
so sysfs will give us system info.
this will give info of full disk size.
cat /sys/block/sda/size
replace sda with your partition name.
ls /sys/block/sda/
will give info about partitions available check for directory naming sda1, sda2 ...
same thing as sda can be used to check size of these partitions.
cat /sys/block/sda/sda1/size
Same note as above watch partition names. change sda to sdb,sdc, etc according to your requirement.
Hope this answers your question.
without mounting the partition I doubt we will be able to read free blocks. there is draw back doing so because this info will be written multiple time to update which may be harmful for disk life. so after disk is mounted and scanned this info is available to you.
â Devidas
Oct 3 '17 at 6:29
It shows the number of all blocks on the partition, not the free ones.
â peterh
Oct 4 '17 at 2:27
Yeah you are right peterh. So I have added comment above stating "without mounting the partition I doubt we will be able to read free blocks". I meant in sysfs or procfs. there are other utilities as stated, but he asked for procfs or sysfs so I mentioned it. what I meant while answering was there is a place where info about all partition is stored in kernel but free scpace is not one of them.
â Devidas
Oct 4 '17 at 6:56
add a comment |Â
up vote
1
down vote
up vote
1
down vote
procfs should be used specifically for process related info. (as it is not stictly followed but still to be on safer side don't depend on it as there is chance of it getting deprecated).
so sysfs will give us system info.
this will give info of full disk size.
cat /sys/block/sda/size
replace sda with your partition name.
ls /sys/block/sda/
will give info about partitions available check for directory naming sda1, sda2 ...
same thing as sda can be used to check size of these partitions.
cat /sys/block/sda/sda1/size
Same note as above watch partition names. change sda to sdb,sdc, etc according to your requirement.
Hope this answers your question.
procfs should be used specifically for process related info. (as it is not stictly followed but still to be on safer side don't depend on it as there is chance of it getting deprecated).
so sysfs will give us system info.
this will give info of full disk size.
cat /sys/block/sda/size
replace sda with your partition name.
ls /sys/block/sda/
will give info about partitions available check for directory naming sda1, sda2 ...
same thing as sda can be used to check size of these partitions.
cat /sys/block/sda/sda1/size
Same note as above watch partition names. change sda to sdb,sdc, etc according to your requirement.
Hope this answers your question.
answered Oct 3 '17 at 6:21
Devidas
1896
1896
without mounting the partition I doubt we will be able to read free blocks. there is draw back doing so because this info will be written multiple time to update which may be harmful for disk life. so after disk is mounted and scanned this info is available to you.
â Devidas
Oct 3 '17 at 6:29
It shows the number of all blocks on the partition, not the free ones.
â peterh
Oct 4 '17 at 2:27
Yeah you are right peterh. So I have added comment above stating "without mounting the partition I doubt we will be able to read free blocks". I meant in sysfs or procfs. there are other utilities as stated, but he asked for procfs or sysfs so I mentioned it. what I meant while answering was there is a place where info about all partition is stored in kernel but free scpace is not one of them.
â Devidas
Oct 4 '17 at 6:56
add a comment |Â
without mounting the partition I doubt we will be able to read free blocks. there is draw back doing so because this info will be written multiple time to update which may be harmful for disk life. so after disk is mounted and scanned this info is available to you.
â Devidas
Oct 3 '17 at 6:29
It shows the number of all blocks on the partition, not the free ones.
â peterh
Oct 4 '17 at 2:27
Yeah you are right peterh. So I have added comment above stating "without mounting the partition I doubt we will be able to read free blocks". I meant in sysfs or procfs. there are other utilities as stated, but he asked for procfs or sysfs so I mentioned it. what I meant while answering was there is a place where info about all partition is stored in kernel but free scpace is not one of them.
â Devidas
Oct 4 '17 at 6:56
without mounting the partition I doubt we will be able to read free blocks. there is draw back doing so because this info will be written multiple time to update which may be harmful for disk life. so after disk is mounted and scanned this info is available to you.
â Devidas
Oct 3 '17 at 6:29
without mounting the partition I doubt we will be able to read free blocks. there is draw back doing so because this info will be written multiple time to update which may be harmful for disk life. so after disk is mounted and scanned this info is available to you.
â Devidas
Oct 3 '17 at 6:29
It shows the number of all blocks on the partition, not the free ones.
â peterh
Oct 4 '17 at 2:27
It shows the number of all blocks on the partition, not the free ones.
â peterh
Oct 4 '17 at 2:27
Yeah you are right peterh. So I have added comment above stating "without mounting the partition I doubt we will be able to read free blocks". I meant in sysfs or procfs. there are other utilities as stated, but he asked for procfs or sysfs so I mentioned it. what I meant while answering was there is a place where info about all partition is stored in kernel but free scpace is not one of them.
â Devidas
Oct 4 '17 at 6:56
Yeah you are right peterh. So I have added comment above stating "without mounting the partition I doubt we will be able to read free blocks". I meant in sysfs or procfs. there are other utilities as stated, but he asked for procfs or sysfs so I mentioned it. what I meant while answering was there is a place where info about all partition is stored in kernel but free scpace is not one of them.
â Devidas
Oct 4 '17 at 6:56
add a comment |Â
up vote
0
down vote
There is no general way for that, but there is a way which works in most cases.
The reason, why there is no general way for that, that also the kernel doesn't know it. To know it, first it would need to analyze the partition.
Without mounting the partition, the kernel knows only its existence, but no more. Essentially, it is a line of blocks with random data. The kernel knows, where is it and how to access, but doesn't know, what to do with it.
However, there are also user-space tools which can analyze the content of a filesystem, without mounting them. As all the filesystems have very different data structures, to handle them you need different tools.
In the case of ext2/3/4, it is
# dumpe2fs /dev/your_root|grep '^Free blocks'
dumpe2fs 1.42.13 (17-May-2015)
Free blocks: 5721580
add a comment |Â
up vote
0
down vote
There is no general way for that, but there is a way which works in most cases.
The reason, why there is no general way for that, that also the kernel doesn't know it. To know it, first it would need to analyze the partition.
Without mounting the partition, the kernel knows only its existence, but no more. Essentially, it is a line of blocks with random data. The kernel knows, where is it and how to access, but doesn't know, what to do with it.
However, there are also user-space tools which can analyze the content of a filesystem, without mounting them. As all the filesystems have very different data structures, to handle them you need different tools.
In the case of ext2/3/4, it is
# dumpe2fs /dev/your_root|grep '^Free blocks'
dumpe2fs 1.42.13 (17-May-2015)
Free blocks: 5721580
add a comment |Â
up vote
0
down vote
up vote
0
down vote
There is no general way for that, but there is a way which works in most cases.
The reason, why there is no general way for that, that also the kernel doesn't know it. To know it, first it would need to analyze the partition.
Without mounting the partition, the kernel knows only its existence, but no more. Essentially, it is a line of blocks with random data. The kernel knows, where is it and how to access, but doesn't know, what to do with it.
However, there are also user-space tools which can analyze the content of a filesystem, without mounting them. As all the filesystems have very different data structures, to handle them you need different tools.
In the case of ext2/3/4, it is
# dumpe2fs /dev/your_root|grep '^Free blocks'
dumpe2fs 1.42.13 (17-May-2015)
Free blocks: 5721580
There is no general way for that, but there is a way which works in most cases.
The reason, why there is no general way for that, that also the kernel doesn't know it. To know it, first it would need to analyze the partition.
Without mounting the partition, the kernel knows only its existence, but no more. Essentially, it is a line of blocks with random data. The kernel knows, where is it and how to access, but doesn't know, what to do with it.
However, there are also user-space tools which can analyze the content of a filesystem, without mounting them. As all the filesystems have very different data structures, to handle them you need different tools.
In the case of ext2/3/4, it is
# dumpe2fs /dev/your_root|grep '^Free blocks'
dumpe2fs 1.42.13 (17-May-2015)
Free blocks: 5721580
answered Oct 4 '17 at 2:35
peterh
3,97792755
3,97792755
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f395745%2ffree-space-in-unmounted-partition%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
bro it gives total space of the partition.
â Sarthak_Bhutani
Oct 6 '17 at 4:55