Running out of space on Server OS drive, where SQL Server app located, what to clear out?

  • quinn.jay - Friday, January 12, 2018 3:25 PM

    RandomStream - Friday, January 12, 2018 2:38 PM

    That's a very courageous attempt on a Friday.  I hope you understood the implications of the cleanup and the server is not mission critical. How much space did you reclaim from that?

    None, but now you're scaring me. It failed with that error, and I think it did nothing, certainly no space was reclaimed

    If  that folder is not taking up large amount of space (say, less than 5GB), I suggest you leave it alone for now and run the queries I provided and post some details. Based on the results, we could provide additional suggestions. Without seeing the system we can only guess what might be taking up space.

  • RandomStream - Friday, January 12, 2018 3:29 PM

    quinn.jay - Friday, January 12, 2018 3:25 PM

    RandomStream - Friday, January 12, 2018 2:38 PM

    That's a very courageous attempt on a Friday.  I hope you understood the implications of the cleanup and the server is not mission critical. How much space did you reclaim from that?

    None, but now you're scaring me. It failed with that error, and I think it did nothing, certainly no space was reclaimed

    If  that folder is not taking up large amount of space (say, less than 5GB), I suggest you leave it alone for now and run the queries I provided and post some details. Based on the results, we could provide additional suggestions. Without seeing the system we can only guess what might be taking up space.

    I ran all that code and there is so much sensitive info I have to chop out that it wont leave much useful info is the problem.  I was able to whack a number of event view logs, to open more space, so I got a little bit more breathing room

  • No, it does not simply truncate the current error log, it closes the current error log and cycles the error logs in a similar fashion to a server restart, see these two articles for details:
    https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-cycle-errorlog-transact-sql and
    https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-cycle-agent-errorlog-transact-sql.

    ...

  • Suggest you start by listing all the files on the C: drive by size and then address them in that order, here is a script that does the file listing
    😎

    CREATE TABLE #DIRLIST_C (D_ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,D_TXT NVARCHAR(4000) NULL);
    INSERT INTO #DIRLIST_C (D_TXT)
    EXEC xp_cmdshell N'dir C:\ /S';

    SELECT * FROM (
    SELECT
      DC.D_ID
     ,SUBSTRING(DC.D_TXT,1,17)     AS TSTR
     ,SUBSTRING(DC.D_TXT,18,18)     AS SSTR
     ,ISNUMERIC(SUBSTRING(DC.D_TXT,18,18)) AS NMBFLG
     ,CASE
       WHEN ISNUMERIC(SUBSTRING(DC.D_TXT,18,18)) = 1 THEN CONVERT(BIGINT,REPLACE(REPLACE(SUBSTRING(DC.D_TXT,18,18),',',''),'File(s)',''),1) / POWER(2,20)
      END AS XIZE
     ,DC.D_TXT
    FROM  #DIRLIST_C DC
    WHERE DC.D_TXT  IS NOT NULL
    AND  ISNUMERIC(SUBSTRING(DC.D_TXT,18,18)) = 1
    ) AS X ORDER BY X.XIZE DESC;

    DROP TABLE #DIRLIST_C;

  • Curious to know why if there are no database files on the OS partition i.e. C: drive, you say in your first post you are shrinking transaction logs? If they are not there what difference does it make?

    ...

  • HappyGeek - Saturday, January 13, 2018 8:56 AM

    Curious to know why if there are no database files on the OS partition i.e. C: drive, you say in your first post you are shrinking transaction logs? If they are not there what difference does it make?

    Suspect there are system db's, dump files, log files etc., would be surprised if otherwise
    😎

    One of the first thing to check is the location of the tempdb, if on the OS drive then add another file on a data drive and shrink the OS drive one. Core dumps can normally be deleted, update directories and temp stuff deleted and the paging file cut down to handful of Gbs.

  • Eirikur Eiriksson - Saturday, January 13, 2018 9:15 AM

    HappyGeek - Saturday, January 13, 2018 8:56 AM

    Curious to know why if there are no database files on the OS partition i.e. C: drive, you say in your first post you are shrinking transaction logs? If they are not there what difference does it make?

    Suspect there are system db's, dump files, log files etc., would be surprised if otherwise
    😎

    One of the first thing to check is the location of the tempdb, if on the OS drive then add another file on a data drive and shrink the OS drive one. Core dumps can normally be deleted, update directories and temp stuff deleted and the paging file cut down to handful of Gbs.

    +100,  personally moved all, or those that can be, off the C: drive on to another drive, completely separate drive for tempdb, paging file would be own drive too if I had the capacity. Logs frankly are a nightmare but can be managed, hence my first suggestion.

    ...

  • 1. Easy 5 minute fix to get you out of the red: Run a tool to identify temp files, recycle folder, download folder, and other stuff that can be deleted off.
    2. Even better if possible: Uninstall unneeded software from server. SSDT, SSRS, and other stuff are sometimes installed and not used.
    3. Permanent fix: Repartition the local drive, reallocating space from D to C, but of course consider downtime and disaster recovery option if it fails.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Eric M Russell - Saturday, January 13, 2018 8:55 PM

    3. Permanent fix: Repartition the local drive, reallocating space from D to C, but of course consider downtime and disaster recovery option if it fails.

    I'd recommend this option if you can swing it.  Generally speaking, databases continue to grow over time because the data tends to grow.  Windows files tend to grow as well, so getting the databases off the system drive should be a priority.  Anything other than getting serious disk space (either with Eric's suggestion or installing more drives) is going to end up being a temporary fix and you're going to end up back in the same spot you are now again soon.  Of course, a SAN with expandable volumes would be a great option if it's available to you, but I don't know if that's realistic.  Whatever route you take, I'd suggest getting as much space as you can to get as much time as possible.

  • HappyGeek - Saturday, January 13, 2018 8:56 AM

    Curious to know why if there are no database files on the OS partition i.e. C: drive, you say in your first post you are shrinking transaction logs? If they are not there what difference does it make?

    Because its something else that growing on a crowded server

  • Grant Fritchey - Friday, January 12, 2018 4:45 AM

    Sounds like you may have data and transaction files on your system drive. Don't. Move those. You'll have to take the databases offline and do a detach/attach, but that will solve the problem. Shrinking files over and over is problematic.

    don't detach\attach. Use the alter database modify file clause to alter the database file paths, take the db offline, move the files then bring it back online

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

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • quinn.jay - Thursday, January 11, 2018 3:58 PM

    I'm running a MS Windows Server 2012 R2, and SQL Server 2016 SP2, the main HDD OS drive is split into two partitions, C:\ and D:\, with lots of space on D:\ and only 60GB total space on C:\ now with less than 5GB left, it's in the red.

    Besides using Minitool trade space around, a radical move, what all can I delete log file wise that keeps growing? I'm already shrinking the T log files each week, and I have found and deleted all the /tmp, /temp, cache, etc usual places.

    How can I delete those old archive logs I see in the log viewer? I have found info on deleting it so I think, but its not it, I want to delete a large swatch of them. I see stuff like go to the database, right click, props, file, slect the log and then remove. Thats not removing those old archive logs I have fro mte h day this thign was stood up.

    Any and all help is greatly appreciated.

    Thanks

    If there are user databases on the c drive move them to d drive.

    60Gb is` a little on the small side for a windows 2012 R2 server system drive, check the page file setting and modify that too.
    The c drive only needs a page file of about 400MB to 800MB for memory dump during BSOD

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

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Shifting gears a bit, it's amazing to me how much junk Windows Updates leaves behind that you can't actually delete.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Tuesday, January 16, 2018 7:29 AM

    Shifting gears a bit, it's amazing to me how much junk Windows Updates leaves behind that you can't actually delete.

    agreed, and when I started this, I thought it was more a SQL Server issue eating up space, but my DBs, and Logs, etc are located on other drives, not the OS drive. I have gone through and deleted all deletable junk, yet I also find that there are things left behind from old installs and such that your can't. plus, being a server, it has all sorts of logging and it is this that is the creeper on space. I admit, our companies rules on bare metal SQL Server boxes 60GB for C:\ OS and DB App is not much. Now I'm left with still considering a space swap with Minitool, and also clearing more out of the Windows events logs as a way to create enough space to deal with over time space creep. This actually makes for a good case to be running a virtual SQL Server, a those adjustments are less risky to make, and a lot easier to than a bare metal box.

  • I use tool on my personal PC to keep tabs on disk space allocation by folder. It would help in your case too.
    https://jam-software.com/treesize_free/

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

Viewing 15 posts - 16 through 30 (of 39 total)

You must be logged in to reply to this topic. Login to reply