help about create a big file and select right partition


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help about create a big file and select right partition
# 1  
Old 08-24-2012
help about create a big file and select right partition

I want create a 40G file one one disk if the disk free space is more than 45G

Code:
[root@localhost ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c9518

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1306    10485760   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2            1306        2612    10487690+  83  Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3            2612        3917    10485760   83  Linux
Partition 3 does not end on cylinder boundary.
/dev/sda4            3917       60801   456923798    5  Extended
/dev/sda5            3917       10444    52431164   83  Linux


Note some of them has been auto mounted

Code:
[root@localhost ~]# df 
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             10321208   6479336   3317584  67% /
tmpfs                 32958812       100  32958712   1% /dev/shm
/dev/sr0               3592530   3592530         0 100% /media/RHEL_6.3 x86_64 Disc 1
/dev/sda5             51608052   6378976  42607520  14% /mnt2

# 2  
Old 08-24-2012
u can get the location by

Code:
 
df -gt|awk 'NR>1&$4>45{print $NF}'

use this in your code as per ur convinience
# 3  
Old 08-24-2012
Quote:
Originally Posted by vidyadhar85
u can get the location by

Code:
 
df -gt|awk 'NR>1&$4>45{print $NF}'

use this in your code as per ur convinience

Code:
[root@localhost ~]# df -gt
df: invalid option -- 'g'
Try `df --help' for more information.

I'm on the redhat, and this only got the mounted disk size
# 4  
Old 08-24-2012
okies how about

Code:
df -k|awk 'NR>1{if(($4/1024/1024)>45){print $NF}}'

# 5  
Old 08-24-2012
Quote:
Originally Posted by vidyadhar85
okies how about

Code:
df -k|awk 'NR>1{if(($4/1024/1024)>45){print $NF}}'

It should be $3...

Code:
df -k|awk 'NR>1{if(($3/1024/1024)>45){print $NF}}'

# 6  
Old 08-24-2012
stat -f filesystem will give you some output like
Code:
stat -f /
  File: "/"
    ID: 1d07822b0456aa89 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2491942    Free: 1349083    Available: 1224083
Inodes: Total: 625856     Free: 363409

# 7  
Old 08-24-2012
Quote:
Originally Posted by vidyadhar85
okies how about

Code:
df -k|awk 'NR>1{if(($4/1024/1024)>45){print $NF}}'


you also assume the disk has been mounted, but not all of them mounted

---------- Post updated at 12:25 AM ---------- Previous update was at 12:24 AM ----------

Quote:
Originally Posted by pamu
It should be $3...

Code:
df -k|awk 'NR>1{if(($3/1024/1024)>45){print $NF}}'


you also assume the disk has been mounted, but not all of them mounted
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Shrink LVM partition & create new Linux Primary partition

Hello All, I have a Red Hat Linux 5.9 Server installed with one hard disk & 2 Partitions created on it as follows, /boot - Linux Partition & another is LVM - One VG & under that 5-6 Logical volumes(var,opt,home etc). Here my requirement is to take out 1GB of space from LVM ( Any logical... (5 Replies)
Discussion started by: gr8_usk
5 Replies

2. Shell Programming and Scripting

Comparing Select Columns from two CSV files in UNIX and create a third file based on comparision

Hi , I want to compare first 3 columns of File A and File B and create a new file File C which will have all rows from File B and will include rows that are present in File A and not in File B based on First 3 column comparison. Thanks in advance for your help. File A A,B,C,45,46... (2 Replies)
Discussion started by: ady_koolz
2 Replies

3. UNIX for Dummies Questions & Answers

Create a raw partition

Hi, I had created a primary partition (/dev/sda3) and made ext3 file system on it. then mounted it on a directory and touch a file (x) into this partition. however, I want to remove this partition and recreate it as an empty partition. so I used 'd' in fdisk command and delete that partition.... (3 Replies)
Discussion started by: Siavash sh
3 Replies

4. UNIX for Dummies Questions & Answers

How to select correct partition and kernel argument for grub?

I use command-line mode of GRUB to load kernel, but I can not know how to chose the partition and kernel argument, as followed : please tell me how to do deal with , thanks! (0 Replies)
Discussion started by: cqlouis
0 Replies

5. UNIX for Dummies Questions & Answers

How big is too big a config.log file?

I have a 5000 line config.log file with several "maybe" errors. Any reccomendations on finding solvable problems? (2 Replies)
Discussion started by: NeedLotsofHelp
2 Replies

6. Shell Programming and Scripting

Select some lines from a txt file and create a new file with awk

Hi there, I have a text file with several colums separated by "|;#" I need to search the file extracting all columns starting with the value of "1" or "2" saving in a separate file just the first 7 columns of each row maching the criteria, with replacement of the saparators in the nearly created... (4 Replies)
Discussion started by: capnino
4 Replies

7. UNIX for Dummies Questions & Answers

create new partition

My Linux system's disk is partitioned as follows: center; 1 | 1 | 1 . DEVICE MOUNT POINT SIZE _ hda1 / 100Mb hda5 /usr2048Mb hda6 /home 10Mb hda7 /var512Mb hda8 swap 12Gb There is 4Gb of unpartitioned free space remaining on the disk (in the logical extended partition) The /usr partition... (2 Replies)
Discussion started by: semaphore
2 Replies

8. Solaris

How to Create New Partition

Hi there Background: New to Solaris - installed VM Ware on a vista laptop, then installed Solaris 10 using ISO file. My aim, is to get to stage where I can install Oracle 11g Database. Question: See attached file. Simple question, how do I create a new partition say called "Oracle" 30G in... (11 Replies)
Discussion started by: Ackers
11 Replies

9. Solaris

[help] create partition for /data

hi experts, i had installed and do mirroring with sun solaris 8 v890 sparc, i had forget to make a partition for directory /data, i have 6 hard drive with disk0 mirror disk1(for root,var,opt,etc) ,disk2 mirror disk3(for /data2) and disk4 mirror disk5(for /data3), how to make a new partition for... (2 Replies)
Discussion started by: bucci
2 Replies

10. UNIX for Dummies Questions & Answers

How to view a big file(143M big)

1 . Thanks everyone who read the post first. 2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too. How to view it ? If I want to view 200-300 ,how can I implement it 3 . Thanks (3 Replies)
Discussion started by: chenhao_no1
3 Replies
Login or Register to Ask a Question